Google Map V3 – Allow only one infobox to be displayed at a time

Change this part: google.maps.event.addListener(marker, “click”, function (e) { ib.open(map, this); }); var ib = new InfoBox(myOptions); google.maps.event.addListener(marker2, “click”, function (e) { ib2.open(map, this); }); var ib2 = new InfoBox(myOptions2); to the following: var ib = new InfoBox(); google.maps.event.addListener(marker, “click”, function (e) { ib.close(); ib.setOptions(myOptions) ib.open(map, this); }); google.maps.event.addListener(marker2, “click”, function (e) { ib.close(); ib.setOptions(myOptions2) ib.open(map, … Read more

Decoding the Google Maps embedded parameters

This intermediate is not the final answer, and the sequel follows)), just some thoughts Undocumented method. (with ftid instead of place_id parameter) Places API Web Service No warranty in future: https://maps.googleapis.com/maps/api/place/details/json?key=YOUR_API_KEY&ftid=0xd62377123a70817:0x85e89b65fcf7c648& The documented request is: https://maps.googleapis.com/maps/api/place/details/json?key=YOUR_API_KEY&placeid=ChIJFwinI3E3Yg0RSMb3_GWb6IU Need API KEY for this requests Setting up API keys Answer from Google: (JSON – light parsing) { “html_attributions” … Read more

How to offset the center of a Google maps (API v3) in pixels?

Found this question when researching and thought I should provide an answer: function map_recenter(latlng,offsetx,offsety) { var point1 = map.getProjection().fromLatLngToPoint( (latlng instanceof google.maps.LatLng) ? latlng : map.getCenter() ); var point2 = new google.maps.Point( ( (typeof(offsetx) == ‘number’ ? offsetx : 0) / Math.pow(2, map.getZoom()) ) || 0, ( (typeof(offsety) == ‘number’ ? offsety : 0) / … Read more

Googlemaps API Key for Localhost

Go to this address: https://console.developers.google.com/apis Create new project and Create Credentials (API key) Click on “Library” Click on any API that you want Click on “Enable” Click on “Credentials” > “Edit Key” Under “Application restrictions”, select “HTTP referrers (web sites)” Under “Website restrictions”, Click on “ADD AN ITEM” Type your website address (or “localhost”, “127.0.0.1”, … Read more

Google street view URL

Building a Google Street View URL Basic Google Map URL http://maps.google.com/maps?q= q= Query – anything passed in this parameter is treated as if it had been typed into the query box on the maps.google.com page. Basic url to display GPS cords location http://maps.google.com/maps?q=31.33519,-89.28720 http://maps.google.com/maps?q=&layer=c layer= Activates overlays. Current options are “t” traffic, “c” street view. … Read more

Using initMap and initAutocomplete on same html page google maps

You can’t add multiple callbacks (and you shouldn’t include the API more than once). Put all the code in a single callback. <script src=”https://maps.googleapis.com/maps/api/js?key=[API KEY]&signed_in=true&libraries=places&callback=initialize” async defer></script> function initialize() { initMap(); initAutoComplete(); } or see this example in the documentation function initialize() { initMap(); initAutocomplete(); } var map, marker; function initMap() { map = new … Read more