GeoX Rails Geocoding Plugin 39

Posted by science on September 25, 2007

Norden bombsight schematic

Science is happy to release an open source geocoding engine built in pure Ruby for the Ruby on Rails environment. You can down load the plugin by following instructions here. (Update 10/21/07 – new features!)

The engine is capable, out of the box, of using MapQuest, Google and Yahoo API’s. All you have to do is obtain a free API key from the provider of your choice. If you get one from all three, you can play around to see which one you prefer.

Your input and comments would be welcome.

From my testing and analysis, it appears that currently Google has the best API engine on quality – though a year ago I would have said Yahoo. Right now Yahoo is the worst of the three. Google isn’t so great for bulk geocoding, at least in my experience (MapQuest is better). Here’s the skinny:


  • +/- 50,000 searches per day (but rate limited in some hidden way – you can’t do 50,000 searches in a day unless you spread them out very evenly)
  • + Returns street/city names with human readable / mixed-case text
  • + Easy to search by intersection using human readable formats like “Main st and Pine st”
  • + Provides choices on ambiguous geocodes


  • + 50,000 searches per day
  • + Provides choices on ambiguous geocodes
  • - Returns street/city names in all upper case
  • +/- Permits intersection searching but only if you substitute in “@” between streets


  • - 5,000 searches per day
  • - Provides no choices on ambiguous geocodes (but did a year ago)
  • - Returns street/city names in all upper case
  • - Doesn’t seem to provide much support for intersections

Use this link to trackback from your own site.


Leave a response

  1. James Stewart Tue, 25 Sep 2007 08:52:06 UTC

    Just wondering what GeoX offers over graticule/acts_as_geocodable/acts_as_locateable/etc?

  2. science Tue, 25 Sep 2007 10:45:58 UTC

    I couldn’t find a tool that supported the MapQuest OpenAPI engine which is why I wrote GeoX. That’s probably the main feature over other tools. It’s also very modular so it’s easy to write additional geocoders – not sure how hard that is in other engines.

    GeoX’s design is “pure Ruby” – though it’s packaged as a plugin, it doesn’t depend on very much inside Rails (.blank? is the only method that I think I’m using out of Rails). As a result, integration with models is a little less tight which some people would regard as a defect, but which I prefer. Adapting it for Ruby-only projects would be easy. If you try it, let me know how it compares.

  3. James Stewart Tue, 25 Sep 2007 13:01:53 UTC

    Adding extra drivers to graticule (a standalone gem) is very easy (I submitted the initial version of one of them) and it now supports failover, so you can recover gracefully from connection problems with your main provider.

    I’ll try and spend some time with GeoX soon and add it to my comparison chart of rails geocoding tools.

  4. science Tue, 25 Sep 2007 13:14:22 UTC

    Oh – that’s a really good idea. I’ll add failover to GeoX! Thanks.

  5. Andrew Selder Wed, 10 Oct 2007 16:09:50 UTC

    I love this plug in… great work.

    A couple suggestions.

    1. Instead of using an API key file in the plug-in directory, copy the file to the config directory. That way you can use an svn:external link to the plugin.

    2. Allow for easy switching of api keys based on environment.

  6. a work on process » Rails Geo Plugins: GeoX Tue, 16 Oct 2007 10:26:20 UTC

    [...] GeoX is the latest kid on the Ruby on Rails geocoding block. The plugin was announced a couple of weeks ago and I’ve been meaning to explore it ever since, just in case it had any new features and also so that I can add it to my comparison chart. [...]

  7. science Mon, 22 Oct 2007 02:42:08 UTC

    I’ve updated GeoX to support failover geocoding. It’s as easy as passing an array into the geocode init routine instead of a single engine. See the wiki or README file for details.

    Also, you can now locate your geox_api_keys.rb file in the Rails root/config folder so you can have an SVN:external link to my code base and stay current more easily.

  8. Jason Belec Thu, 28 Feb 2008 10:08:14 UTC

    I’ve been looking for a way to improve the geocode returns and wanted to use the phone number to get a more exact location or to enhance a current location return… Any ideas?

  9. science Thu, 28 Feb 2008 11:26:06 UTC

    Jason: There are a number of resources out on the web that you can use to use a phone number to determine a general area. Because so many numbers are portable (i.e. cell phones), it’s often impossible to know for sure where a phone is located (so an 510 number indicates the Eastern part of the San Francisco Bay Area, but I know people with a 510 area code on their cell who live full time in New York City).

    With that caveat you could pre-process your incoming addresses with something like:

    This is just an example – google “area codes region lookup” or variations to find tons more info.

    I’d recommend wrapping GeoX in a pre-processing class that handles conversion from phone numbers to geography where possible. Basically a geocoder should get geographic information, and you should pre-process phone numbers to generate required geographic information which you submit to the big geocoder engines for conversion to lat/long. Hope that helps!

  10. Jason Belec Thu, 28 Feb 2008 12:36:49 UTC

    Thanks, that link alone is worth your weight in gold. And thank you for the wrapper idea, should solve some issues I listed out. I will report back after some testing.

  11. Norman Clarke Thu, 06 Mar 2008 12:44:01 UTC

    Thanks for putting in the time on this useful plugin. It’s very handy for me that it provides a list of possible locations, rather than simple pulling off the first match like other plugins like Geokit do.

    One small problem I noticed is that you’re not including the option to request UTF-8 from the Google geocode service. This messes up quite a few things in an application I’m working on because place names with accent marks get truncated after the first accented character.

    To fix this, simply modify google.rb on line 38:


    url << “output=xml”


    url << “output=xml&oe=utf-8″

  12. science Thu, 06 Mar 2008 14:52:11 UTC

    Norman: That’s all set – new code uploaded to SVN.

    Here’s how you set Google “locale”:

    location = {:address => '1711 Martin Luther King Junior Wy', :city => 'Berkeley', :state => 'CA'}
    geocoder = => GeoX::Google, :locale => 'oe=utf8')
    locations = geocoder.geocode(location)

    When you create your geocoder, you set this value. It will persist for all subsequent geocodings using that *instance* of the Geocoder.

  13. Norman Clarke Thu, 06 Mar 2008 15:04:05 UTC

    Perfect! Thanks a lot, I’m glad in did a “-x” when I installed the plugin now. :-)

  14. Greg Combs Mon, 18 Oct 2010 09:35:50 UTC

    Bing support? … Or even Bing batch geocoding?

    Seems like they’ve got the most relaxed limitations of any quality/free provider these days.

  15. science Wed, 22 Dec 2010 12:59:54 UTC

    Hi Greg, Thanks – I should add a Bing module. Right now I’m buried in other work (as you can tell from my very tardy reply). But it’s definitely needed as the Bing guys seem to be “giving good api.” If you have any interest in helping to write, I’d be happy to patch your stuff into GeoX and give you support on how to write it. I’ll try to update in the new year if you or someone else doesn’t.

  16. video sexe streaming Fri, 07 Dec 2012 12:30:44 UTC

    video sexe streaming…

    Eugenia Home…

  17. voyance gratuite en ligne Thu, 21 Feb 2013 06:16:54 UTC

    voyance gratuite en ligne…

    Eugenia Home…

  18. HTTP:// Tue, 14 May 2013 14:25:18 UTC


    Eugenia Home…

  19. david Fri, 22 Aug 2014 17:28:54 UTC

    hibernate@trapped.interpolation” rel=”nofollow”>.…

    good info!!…

  20. zachary Sat, 23 Aug 2014 16:49:22 UTC

    gastrointestinal@wrong.wronged” rel=”nofollow”>.…

    спс за инфу!!…

  21. marshall Sat, 23 Aug 2014 19:06:22 UTC

    armstrong@fanfare.commercialization” rel=”nofollow”>.…


  22. Ronnie Sun, 24 Aug 2014 04:26:16 UTC

    precedents@banshees.dressing” rel=”nofollow”>.…

    спс за инфу!…

  23. oliver Fri, 21 Nov 2014 20:15:03 UTC

    rosen@gay.ventured” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  24. Neil Sun, 23 Nov 2014 06:40:51 UTC

    barrack@heydrich.chance” rel=”nofollow”>.…


  25. clifton Tue, 25 Nov 2014 15:26:30 UTC

    spiked@americans.highpoint” rel=”nofollow”>.…


  26. steven Thu, 27 Nov 2014 13:45:54 UTC

    viennese@genuinely.dispersed” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  27. Raymond Sun, 30 Nov 2014 16:01:31 UTC

    burbank@opposes.shorten” rel=”nofollow”>.…

    ñïñ çà èíôó….

  28. rafael Thu, 04 Dec 2014 14:16:40 UTC

    vincent@roos.essentially” rel=”nofollow”>.…

    thank you!!…

  29. Larry Thu, 04 Dec 2014 14:49:12 UTC

    thanks@snared.avocado” rel=”nofollow”>.…


  30. Nelson Thu, 11 Dec 2014 19:55:37 UTC

    distracting@symbols.ehlers” rel=”nofollow”>.…


  31. ben Fri, 12 Dec 2014 16:41:36 UTC

    revrend@sulamite.decreases” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  32. herman Thu, 18 Dec 2014 08:32:30 UTC

    mazowsze@map.bulge” rel=”nofollow”>.…

    tnx for info!…

  33. Leslie Thu, 18 Dec 2014 14:34:44 UTC

    sonambula@shutdown.yancy” rel=”nofollow”>.…


  34. Dustin Thu, 18 Dec 2014 19:02:34 UTC

    busch@mmm.clambering” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  35. Jerry Fri, 19 Dec 2014 09:06:30 UTC

    oscillation@eluate.haberdasheries” rel=”nofollow”>.…


  36. herbert Tue, 23 Dec 2014 08:28:54 UTC

    boniface@passer.alla” rel=”nofollow”>.…

    thank you….

  37. Julio Wed, 24 Dec 2014 19:58:55 UTC

    protected@questioned.thawing” rel=”nofollow”>.…


  38. wallace Thu, 15 Jan 2015 01:14:10 UTC

    lawn@hank.unknown” rel=”nofollow”>.…


  39. craig Sat, 17 Jan 2015 22:41:40 UTC

    fervor@inconceivable.beryl” rel=”nofollow”>.…

    tnx for info….