Google Map API - Adding address markers and geocoding

December 18, 2007 · Filed Under Getting Started, Resources 

I had a need to add a set of markers to a Google map using the Google Maps API that could be easily modified over time.  It is fairly easy to add markers with the Google Maps API but I wanted to put something together that will do the geocoding at the same time so I don’t have to manually add the lat / lng coordinates when I just want to add an address.  As a result I put together the following bit of script.  The addresses are loaded from an xml file named data.xml, geocoded and then added to the map.  If you are going to use this example for yourself, just add your Google Maps API key and enter the addresses you want to add. You can visit a LIVE SAMPLE or download the full html page and associated data.xml file from HERE.  If you would like to geocode a single address visit this site.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Technorati

Comments

2 Responses to “Google Map API - Adding address markers and geocoding”

  1. mark on February 15th, 2008 8:20 am

    I’m interested in the google maps integration on my webpages starter kit installation. I was wondering though if we could feed it a variable to show location of all my members based upon info they provide IE their address? Love to talk with you.

    -Mark

  2. jason on February 15th, 2008 11:56 am

    Mark,

    Should certainly be possible. How are your member addresses stored? (SQL db, excel, xml, etc..) The main issues should getting the addresses formatted into xml that the geocoder can read, return lat/ lng and add to the map. You can contact me at admin@aspstarterkit.com if you want to share more details.

    Jason

Leave a Reply