How to customise the FixMyStreet geocoder

The first step of using FixMyStreet is entering a string that the needs to be geocoded to take you to a relevant map page.

See the diagram below for the full flow of using FixMyStreet. The geocoder is near the start of the process, before maps, MapIt boundaries or bodies enter the picture.

The geocoder takes a string – for example, the name of a place or a street – and converts it into a lat-long location.

The geocoder defaults to OpenStreetMap’s Nominatim. FixMyStreet also contains Bing and Google based geocoders, and can use custom geocoders too.

You can customise the geocoding by providing limiting parameters in GEOCODING_DISAMBIGUATION. You typically need to do this so the geocoder only considers places in the area your FixMyStreet site is serving. For example, you may want to limit results to a specific country or city.

The options vary depending on which geocoder you use.

If you’re running a site in the UK and want junction lookup (e.g. “M5 junction 11a”) then see the Junction lookup section below.

Detailed flow: location → map pin → drop-down menu

FMS bodies and contacts

Junction lookup

If the site is going to be run in the UK and you’d like the ability to do junction lookups, i.e. allow the user to search for “M60, Junction 2” and have it geocode to the correct location, then you’ll need to generate a junctions database.

$ mkdir ../data
$ wget
$ unzip Gazetteer\ All\ Mposts\
$ in2csv Gazetteer_All_Mposts_only.xlsx > markerposts.csv
$ bin/make-junctions-database markerposts.csv

This will create a SQLite database at ../data/roads.sqlite. If this is present then it will be used by the postcode search to do a junction lookup.