Geocoding webservice for Ghent with basic spatial inference
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

gheocode: geocoding for Ghent


gheocode is a very simple wrapper around Google's geocoding service. But in addition to the regular latitude/longitude data and address normalisation, you get a small dash of geoinference. I.e. for each geocoded address in Ghent, you get the name and code of both the block and administrative sector the point is located in. To minimalise the load on Google's servers (you get a fixed amount of requests per day), responses are cached using a Redis key-value store.


An example/testing service is running here, but for heavier use then that, please use a local install. This should get you running:

$ git clone git://
$ cd gheocode
$ sudo apt-get install redis-server libgeos-c1
$ pip install -r requirements.txt
$ nosetests


$ redis-server &
$ python


You can query the service with a simple GET-request containing the urlencoded address:

$ curl

    "geocode_status": "OK", 
    "sector_code": "A02", 
    "number": "3", 
    "full_address": "Korte Meer 3, 9000 Ghent, Belgium", 
    "street": "Korte Meer", 
    "postal_code": "9000", 
    "lat": 51.0513082, 
    "query": "korte Meer 3 9000 Gent", 
    "geoinference_status": "OK", 
    "lng": 3.7228493, 
    "sector_name": "Kouter", 
    "country": "Belgium", 
    "locality": "Ghent", 
    "block_name": "Binnenstad", 
    "valid_address": true, 
    "block_code": "BIN"

The service is most effectively used in combination with Google Refine. Using the function "Add column by fetching URLs" on a column containing addresses in Ghent will pull in all the data in the form of a JSON structure which you then can futher process.

Use a GREL expression such as '' + escape(value, 'url') to fetch the data and value.parseJson()["sector_code"] to process the the resulting data into usable columns.


Uses open data made available by the city of Ghent. Runs on Flask, shapely, pygeocoder and redis + bindings.