JS-Placemaker is a JavaScript wrapper for the Yahoo Placemaker web service using an YQL execute table to allow you to extract geo location information out of any text in various languages.

Examples

Simply click the "find locations" buttons in the following examples to see what geographical information Placemaker can find.

Results

How to use JS-Placemaker

The first thing to do if you want to use JS-Placemaker is to get your own application ID for Placemaker.

Then all you need to do is include JSPlacemaker.js into your document and override the appID with yours.


Placemaker.config.appID = YOUR_APP_ID;
Placemaker.getPlaces(text,callback,locale); 
text
Freeform text to analyze
callback
function to call when the locations have been found
locale (optional)
locale of the text, f.e.'de-de' or 'fr-fr' or 'en-uk'

The callback function will get an object as the return value. If there weren't any locations found, this will have an error property, otherwise it has a match return value which is an object if there was only one result or an array when there were several. Each of these objects has a name, a type, a woeid and a centroid object which contains a latitude and a longitude.

For example the following call of JSPlacemaker returns in the object shown in the screenshot:

 
Placemaker.getPlaces('Hi I am Chris, I live in London. Originally I am from Germany',
function(o){
  console.log(o);
},
'en-uk'); 

JS-Placemaker - geolocate texts in JavaScript by you.

If you define the locale you can also user other languages:


Placemaker.getPlaces('Hallo ich bin der Christian und komme aus 
Schweinfurt in Deutschland. Leben tu ich allerdings in England',
function(o){
  console.log(o);
},
'de-de');

JS-Placemaker - german query by you.

Also works in French:


Placemaker.getPlaces('Bonjour, c\'est Christian. 
J\'habite en Londres en Angleterre, mais je suis Allemande',
function(o){
  console.log(o);
},'fr-fr'); 

JS-Placemaker - french query by you.

That's it

Check the source of this page for the demo that makes the buttons above work. Happy geolocating!