Guide

Offline geocoding in Python

Address to coordinates and back, from a local file per country. No server, no API key, no rate limit.

Install and download a country

terminalpip
$ pip install gridpin-mcp   # includes the engine
$ gridpin-fetch fr         # France, 365 MB, verified download; prints the path

Countries: br de es fr it nl rs, from 32 MB (Serbia) to 677 MB (Brazil). gridpin-fetch --list shows them all.

Forward, reverse and batch

geocode.pyPython
import gridpin
from gridpin_mcp import sheets

g = gridpin.Geocoder(str(sheets.download("fr")))   # memory-mapped, opens instantly

g.geocode("1 rue de la Paix, 75002 Paris", 1)
# -> house, Rue de la Paix 1, Paris 2e Arrondissement, 48.868546, 2.33031

g.reverse(48.8686, 2.3305, 1)
# -> house, Rue de la Paix 3, distance_m 10.5

g.geocode_many(["8 Boulevard du Port, Amiens", "1 rue de la Paix, Paris"], 1)   # all cores

Every result carries precision: house is a door-level match, street and city are approximate. When nothing fits, the answer is empty rather than a guess. Exact lookups run at about 3,000 per second on one laptop core.

Compared with city-level libraries

Packages such as reverse_geocoder return the nearest city from GeoNames, for the whole world. GridPin returns the street and house number, for seven countries: Brazil, France, Germany (without Bavaria), Italy, Netherlands, Serbia and Spain. If a city is enough, or you need another country, the city-level packages are the right tool.