Check if infowindow is opened Google Maps v3

This is an undocumented feature, and is therefore subject to change without notice, however the infoWindow.close() method sets the map on the object to null (this is why infoWindow.open(map, [anchor]) requires that you pass in a Map), so you can check this property to tell if it is currently being displayed: function isInfoWindowOpen(infoWindow){ var map … Read more

Using Google maps API v3 how do I get LatLng with a given address?

There is a pretty good example on https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple To shorten it up a little: geocoder = new google.maps.Geocoder(); function codeAddress() { //In this case it gets the address from an element on the page, but obviously you could just pass it to the method instead var address = document.getElementById( ‘address’ ).value; geocoder.geocode( { ‘address’ : … Read more

Retrieve latitude and longitude of a draggable pin via Google Maps API V3

Either of these work google.maps.event.addListener(marker, ‘click’, function (event) { document.getElementById(“latbox”).value = event.latLng.lat(); document.getElementById(“lngbox”).value = event.latLng.lng(); }); google.maps.event.addListener(marker, ‘click’, function (event) { document.getElementById(“latbox”).value = this.getPosition().lat(); document.getElementById(“lngbox”).value = this.getPosition().lng(); }); You might also consider using the dragend event also google.maps.event.addListener(marker, ‘dragend’, function (event) { document.getElementById(“latbox”).value = this.getPosition().lat(); document.getElementById(“lngbox”).value = this.getPosition().lng(); });

What is a good, unlimited alternative to Google Places API? [closed]

First up, I hope you know that you can bump your Places API quota from 1,000 queries/day up to 100,000 queries/day just by verifying your identity? This doesn’t cost anything. And if even 100,000 QPD are not enough, you can purchase a Google Places API for Business license. But to actually answer your question, I’m … Read more

hide local listings from google maps api

you can set them invisible by setting the map style properly. See http://code.google.com/apis/maps/documentation/javascript/styling.html and http://code.google.com/intl/pl/apis/maps/documentation/javascript/reference.html#MapTypeStyleFeatureType sth like that should do the trick (though not tested): var noPoi = [ { featureType: “poi”, stylers: [ { visibility: “off” } ] } ]; map.setOptions({styles: noPoi});

Using Icon Fonts as Markers in Google Maps V3

I just had the same problem – decided to do a quick and dirty conversion and host on github. https://github.com/nathan-muir/fontawesome-markers You can manually include the JS file, or use npm install fontawesome-markers or bower install fontawesome-markers. Just include the javascript file fontawesome-markers.min.js and you can use them like so: new google.maps.Marker({ map: map, icon: { … Read more

Leaflet Map API with Google Satellite Layer [duplicate]

You don’t need a plugin or the Google API, you can add it as a XYZ tile layer. Streets googleStreets = L.tileLayer(‘http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Hybrid: googleHybrid = L.tileLayer(‘http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Satellite: googleSat = L.tileLayer(‘http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Terrain googleTerrain = L.tileLayer(‘http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Note the difference in the … Read more

get boundaries longitude and latitude from current zoom google maps

You are half way there. All you need to do is to get the map bounds and then extract (and properly use) the coordinates of the corners. var bounds = map.getBounds(); var ne = bounds.getNorthEast(); // LatLng of the north-east corner var sw = bounds.getSouthWest(); // LatLng of the south-west corder You get north-west and … Read more

Google maps v3 draggable marker

Finally I found the answer: marker = new google.maps.Marker( { map:map, draggable:true, animation: google.maps.Animation.DROP, position: results[0].geometry.location }); google.maps.event.addListener(marker, ‘dragend’, function() { geocodePosition(marker.getPosition()); }); function geocodePosition(pos) { geocoder = new google.maps.Geocoder(); geocoder.geocode ({ latLng: pos }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { $(“#mapSearchInput”).val(results[0].formatted_address); $(“#mapErrorMsg”).hide(100); } else { $(“#mapErrorMsg”).html(‘Cannot determine address at this location.’+status).show(100); } … Read more

Access Google’s Traffic Data through a Web Service

UPDATE (May 2022): From @AbdullahTahan: Now google has this feature but it’s paid and costs 0.01$ per request check this https://developers.google.com/maps/documentation/distance-matrix/distance-matrix#distance-matrix-advanced UPDATE (March 2016): A lot has happened since this answer was written in 2011, but the core points appear to hold up: You won’t find raw traffic data in free API services (at least … Read more