Monday, February 01, 2010

JavaScript to Add a Google Map


Addmap.js is a JavaScript that analyses text on a web page to find geographical locations and then adds a Google Map showing the locations. The script adds a Google Static Map to a web page and a list of the found locations within the page.

To use the script you just need to add your own Google Maps API key and to place the text you want mapped within a div element with an id of 'content'.

The JavaScript is very easy to add to a page. I've created an example, The Start of the Second World War, using some text from Wikipedia. Feel free to view the source of the page and cut & paste to your heart's content.


No comments: