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 Map API – Removing Markers

You need to keep an array of the google.maps.Marker objects to hide (or remove or run other operations on them). In the global scope: var gmarkers = []; Then push the markers on that array as you create them: var marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i].latitude, locations[i].longitude), title: locations[i].title, icon: icon, map:map }); // … Read more

Responsive Google Map?

Add this to your initialize function: <script type=”text/javascript”> function initialize() { var map = new google.maps.Map(document.getElementById(“map-canvas”), mapOptions); // Resize stuff… google.maps.event.addDomListener(window, “resize”, function() { var center = map.getCenter(); google.maps.event.trigger(map, “resize”); map.setCenter(center); }); } </script>

Detect the nearest transit stop from the given location

Well, you could use the places-API to find the nearest transit-stops, it works fine for me for the given location. Just do a request with the parameters: location (latlng-object of the given location) radius(radius to search for in meters) types(array of valid types, e.g. [‘bus_station’,’subway_station’]) Checkout the fiddle: http://jsfiddle.net/doktormolle/aZrvs/ For retrieving further details(bus service No, … Read more

Is it possible to write custom text on Google Maps API v3?

To show custom text you need to create a custom overlay. Below is an example adapted from official Google documentation. You could also use this library for more “stylish” info windows <html> <head> <script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”> </script> <script> //adapded from this example http://code.google.com/apis/maps/documentation/javascript/overlays.html#CustomOverlays //text overlays function TxtOverlay(pos, txt, cls, map) { // Now initialize all … Read more

Google Maps API V3 Infobox.js removed

It seems that the library is being moved to Github (it seems the infobox.js wasn’t moved yet), see the announcement on main page: https://code.google.com/p/google-maps-utility-library-v3/ But still, the problem with your code is that it’s not a good practise to reference code from code.google.com svn repository. It’s like referencing a code from Github, it can be … Read more