Friday, January 29th, 2010
Addmap.js – automatically analyse a text for geo locations and add a map
<p>As part of an upcoming article on geo location I am putting together a few Geo Toys for myself and here is the first one. Addmap.js is a JavaScript that analyses an elements text content, finds geographical locations and links them to Google Maps. It also adds a map preview and a list of the found locations to the element.See addmap.js in action below - all the content in the green box is generated from the paragraph of text above it. You can try it out for yourself by clicking the screenshot.
Using addmap.js is easy - sign up for a Google Maps Key and provide it as a configuration parameter. Then call the analyse function with the ID of the element to analyse as the parameter:
-
<script src="http://github.com/codepo8/geotoys/raw/master/addmap.js"></script>
-
<script>
-
addmap.config.mapkey = 'YOUR_API_KEY';
-
addmap.analyse('content');
-
</script>
The script uses YQL and Yahoo PlaceMaker under the hood, for more info and updates on this, check the blog.
Related Content:












Maybe is a off topic but when I ‘ve seen the example I wonder if is it a good practice load js files directly from github instead of copy them in a hosting. Can I build an application with all js files on github, or only for examples and testing? Google code doesn’t allow it as I read in the TOS