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’]
alert( + ‘,’ + +
‘ (‘ + + ‘,’ + + ‘)’

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

  1. Reply Tom Glenn March 12, 2010 at 6:41 AM

    Excellent! This will come in extremely handy when developing link tracking for!


  2. Reply Turnkeye March 12, 2010 at 1:23 PM

    geo calculations are rather slow

  3. Reply Ryan March 13, 2010 at 8:54 AM

    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

  4. Reply Douglas Manseau March 25, 2011 at 9:53 AM

    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!

  5. Reply Umut M. March 26, 2011 at 3:49 PM

    @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.

  6. Reply matt December 21, 2011 at 5:38 AM

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

Leave a reply