get city from geocoder results?

Got this working in the end using: var arrAddress = item.address_components; var itemRoute=””; var itemLocality=”; var itemCountry=”; var itemPc=””; var itemSnumber=””; // iterate through address_component array $.each(arrAddress, function (i, address_component) { console.log(‘address_component:’+i); if (address_component.types[0] == “route”){ console.log(i+”: route:”+address_component.long_name); itemRoute = address_component.long_name; } if (address_component.types[0] == “locality”){ console.log(“town:”+address_component.long_name); itemLocality = address_component.long_name; } if (address_component.types[0] == “country”){ … Read more

Google Maps API – Get Coordinates of address

What you are looking for is called Geocoding. Google provides a Geocoding Web Service which should do what you’re looking for. You will be able to do geocoding on your server. JSON Example: http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA XML Example: http://maps.google.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA Edit: Please note that this is now a deprecated method and you must provide your own Google API … Read more

How to convert an address into a Google Maps Link (NOT MAP)

How about this? https://maps.google.com/?q=1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003 https://maps.google.com/?q=term If you have lat-long then use below URL https://maps.google.com/?ll=latitude,longitude Example: maps.google.com/?ll=38.882147,-76.99017 UPDATE As of year 2017, Google now has an official way to create cross-platform Google Maps URLs: https://developers.google.com/maps/documentation/urls/guide You can use links like https://www.google.com/maps/search/?api=1&query=1200%20Pennsylvania%20Ave%20SE%2C%20Washington%2C%20District%20of%20Columbia%2C%2020003

Autocomplete in SearchBox does not work even in official example

Using the previous version of the Google Maps API worked for me. I was using v=3.exp and changed it to v=3.0 <script src=”https://maps.googleapis.com/maps/api/js?v=3.0&key=YOUR_KEY&libraries=places”></script> See : https://developers.google.com/maps/documentation/javascript/versions Related bug in the issue tracker: https://issuetracker.google.com/issues/74048143 (from xomena’s comment)

Google Maps Multiple markers with the exact same location Not working

You need to : create the marker clusterer first. add the markers to the MarkerClusterer (and format your code so it is easier to read…). function createMarker(latlng,text) { var marker = new google.maps.Marker({ position: latlng, map: map }); ///get array of markers currently in cluster var allMarkers = mc.getMarkers(); //check to see if any of … Read more

Polygon of world map with a hole (google maps)

You need to make the winding direction of the outer polygon opposite that of the inner polygon and add a point: var worldCoords = [ new google.maps.LatLng(-85.1054596961173, -180), new google.maps.LatLng(85.1054596961173, -180), new google.maps.LatLng(85.1054596961173, 180), new google.maps.LatLng(-85.1054596961173, 180), new google.maps.LatLng(-85.1054596961173, 0) ]; working fiddle working code snippet: function initialize() { var mapOptions = { zoom: 1, … Read more

Google Maps API Polygon with “Hole” In Center

It really is a matter of direction of indices in your polygons, while one is clockwise other should be counter-clockwise. Change your second array to: var circleOverlay = [ new google.maps.LatLng(25.774252, -80.190262), new google.maps.LatLng(32.321384, -64.75737), //second and third coordinates new google.maps.LatLng(18.466465, -66.118292), //are swapped compared to your original new google.maps.LatLng(25.774252, -80.190262) ]; and it will … Read more

Is it possible to get an address from coordinates using google maps?

yes. Just use Google Geocoding and Places API https://developers.google.com/maps/documentation/geocoding/ and https://developers.google.com/maps/documentation/places/ Example (derived from here): var geocoder; function initialize() { geocoder = new google.maps.Geocoder(); } function codeLatLng(lat, lng) { var latlng = new google.maps.LatLng(lat, lng); geocoder.geocode({ ‘latLng’: latlng }, function (results, status) { if (status === google.maps.GeocoderStatus.OK) { if (results[1]) { console.log(results[1]); } else { … Read more