Home > Google, JavaScript, Maps, Programming > Geocoding with Google Maps API (Multiple markers)

Geocoding with Google Maps API (Multiple markers)

December 29th, 2010 Leave a comment Go to comments

While working on a restaurant meta-search engine, I wanted to display the restaurants on the map. Google Maps API was what I needed. It is well documented and easy to use. Also, gives you plenty of options to customize your map to your needs. To display a marker at an address, basically you can use a function like below:

//Function creates a marker for given address and places it on the map
function placeAddressOnMap(address) {
  gc.geocode({'address': address}, function (res, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      new google.maps.Marker({
        position: res[0].geometry.location,
        map: map

and call this function for the array of addresses you have. See this working demo of the multiple marker placement.

  1. November 24th, 2012 at 17:07 | #1

    Thanx very much… for the working demo !

  1. No trackbacks yet.