Getting ready

  1. To access GeoNames web services, you need to create a user at http://www.geonames.org/login. The user we created for this recipe is postgis; you will need to change it with your username whenever you query the GeoNames web service URL.
  2. If you are using Windows, be sure to have OSGeo4W installed as suggested in the initial instructions of this chapter.
  3. If you are using Linux, follow the initial instructions for this chapter, create a Python virtualenv in order to keep a Python-isolated environment to be used for all the Python recipes in this book, and activate it:
      $ source postgis-cb-env/bin/activate
  1. Once activated, if you still haven't done so, you have to install the gdal and simplejson Python packages needed for this recipe:
      (postgis-cb-env)$ pip install gdal
      (postgis-cb-env)$ pip install simplejson