May 28 2007

QGIS Geocoding plugin

Published by perrygeo at 10:11 am under Python, QGIS, Software

A few weeks back, I decided to take the plunge and learn the python bindings for QGIS 0.9. My first experiment was to implement a geocoder plugin. What started mostly as a learning experiment turned into something that might actually be useful!

The idea was to use web services to do all the actual geocoding work (the hard part!) and the delimited text provider to load the results into qgis. Right now it’s built on top of the Yahoo geocoder which is, IMO, the best out there.. very flexible about the input format. The geopy module is used to interact with the geocoding services so it could potentially support other engines such as geocoder.us, virtual earth, google, etc.

The user interface is very straightforward; enter list of addresses/placenames seperated by a line break, pick an output file and go. To be legitimate, you should also sign up for a yahoo api key, though the ‘YahooDemo’ key will work ok for testing purposes.

Here’s the install process (assuming you already have python, pyqt4, qgis 0.9, qgis bindings, etc. set up):

 svn checkout http://perrygeo.googlecode.com/svn/trunk/qgis/geocode
 cd geocode
 emacs Makefile # change install directory if needed
 sudo make install

This is just a rough cut and it’s my first attempt at using the qgis and qt apis so there are probably many things that could be improved upon. Ideally this plugin could:

  • Parse text files as input
  • Allow for a choice of geocoding engine
  • ???

Feedback (and patches) welcome ;-)

7 Responses to “QGIS Geocoding plugin”

  1. Markon 26 Jul 2007 at 1:39 am

    Hi Matt,
    Looks like a great plugin but am not able to get it to work under QGIS 0.8 ‘Titan’ running on Debian Feisty. No matter where I install it the plugin doesn’t appear in the manager. I am a newbie when it comes to QGIS so might be missing the obvious. As most QGIS forums seems to be down I was hoping you could point me in the right direction.
    cheers,
    Mark

  2. perrygeoon 26 Jul 2007 at 7:13 am

    Mark,

    This plugin requires QGIS 0.9 with python bindings enabled.

  3. Markon 27 Jul 2007 at 3:41 am

    Ok, am now trying to install 0.9 according to the install process you describe. Got stuck at the QGIS part however, as the syntax you include ‘cmake’ expects a parameter location so basically nothing happens. Any advice?

  4. Markon 02 Aug 2007 at 5:55 am

    Matt,
    Managed to install QGIS unstable now using instructions on: http://spatialgalaxy.net/2007/04/27/building-qgis-on-feisty-fawn/. Was probably missing some packages somewhere…
    Still can’t figure out how to enable the plugin however, it doesn’t show up in the plugin list. Am I missing the obvious?!

    cheers,
    Mark

  5. Julienon 22 Jan 2009 at 5:25 am

    Hi,

    I was looking at the python code of your app, because i’m looking for a method to parse the result of the (google geocoder) geocoded adress, would like to retrieve all the accuracy, and the detailed informations about the adress, just like when using the Js api.

    I do something like that :

    location, (latitude, longitude) = g.geocode(adresse,
    exactly_one=True)
    print location

    would something like that work ? :

    location, (latitude, longitude),altitude = g.geocode(adresse,
    exactly_one=True)
    print altitude

    In fact it does not work, is it possible to retrieve all these informations
    from the geopy google geocoder response and how to ?

    Thks a lot

    Julien

  6. Carloon 05 May 2009 at 1:03 pm

    Perry, the geocoder used to play an interesting role in QGis, as a bridge from desktop to web services. Now it’s not even anymore compatible with later versions. What about revamping it?

  7. perrygeoon 05 May 2009 at 1:13 pm

    I’d love to update it but have no time or interest in doing so. I wrote it as a test plugin for 0.9 so someone is welcome to port it over to the stable API if they wish .. the beauty of open source!

Trackback URI | Comments RSS

Leave a Reply