Geo-Enable Websites With JS: YQL Geo Library

Geolocation is one of the most popular subjects for today's web & there are many solutions that help geo-enabling web applications.

YQL Geo Library is an impressive resource for geolocation as it is totally free & JavaScript-based.

It has various powerful features like:

  • detecting the visitor’s location with the W3C geo API and with IP as a fallback
  • find geo location from text
  • find location from lat/lon pair
  • find locations in a certain web document (by URL)
  • get the location for a certain IP number

YQL Geo Library

The library is lightweight (4kb uncompressed) & non-complicated. It just works by calling a function like:

[sourcecode language=’javascript’]
yqlgeo.get(‘217.12.14.240’,function(o){
alert(o.place.name + ‘,’ + o.place.country.content +
‘ (‘ + o.place.centroid.latitude + ‘,’ +
o.place.centroid.longitude + ‘)’
);
});
[/sourcecode]

will get you the city, country, latitude & longitude of any given IP.

  • Excellent! This will come in extremely handy when developing link tracking for http://tdy.me!

    Thanks

  • geo calculations are rather slow

  • it’s only alert message my location. I thought it will show me my location in map like google map. but it’s very great tool. thanks for share

  • Hey would you mind sharing which blog platform you’re working with? I’m going to start my own blog soon but I’m having a difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S Apologies for being off-topic but I had to ask!

  • @Douglas Manseau,

    It is WordPress and happy with it.

    I think all has pros & cons and any design can be applied to each of them.

    However, WP is probably the most popular one.

  • matt

    The only one that seems to work is the call to the location(paris,fr).None of the others do anything

Search