Geocode Mexican addresses offline
One file for all 32 states, read locally; answers carry the Mexican postal code where the source has one. No server, no API key, and the addresses you geocode never leave your machine.
Get started
The file for Mexico is 156 MB and holds 14.14 million addresses from the INEGI address layer (surveyed 2009–2010; via AddressForAll and Overture Maps) with Correos de México postal codes. Download it once, checked against the signed release; every query after that runs on your machine, with no API key and no rate limit.
$ pip install gridpin-mcp # includes the engine $ gridpin-fetch mx # Mexico, 156 MB, verified download
import gridpin
from gridpin_mcp import sheets
g = gridpin.Geocoder(str(sheets.download("mx"))) # no-op once downloaded
g.geocode("Av. Paseo de la Reforma 222, Juárez, Cuauhtémoc, 06600 Ciudad de México", 1)
# -> house, Avenida Paseo De La Reforma 222, Cuauhtémoc, 06600
g.geocode("Paseo de la Reforma 222, 06600 CDMX", 1)
# -> the same house
g.geocode("Av. Insurgentes Sur 1602, Crédito Constructor, 03940 Benito Juárez, CDMX", 1)
# -> house, Avenida Insurgentes Sur 1602, Benito Juárez, 03940
g.geocode("Calle Madero 30, Centro, 06000 Ciudad de México", 1)
# -> house, Calle Francisco I. Madero 30, Cuauhtémoc, 06000
The usual Mexican form works as written: street and number, colonia, the alcaldía or municipio, the postal code and the state, with CDMX or Ciudad de México. Mexico City codes written without the leading zero, # and C.P. marks and s/n addresses are read too. The address layer was surveyed in 2009–2010: newer streets and numbers are missing, and about half of the source addresses carry a house number.
How often it finds the right house, compared with Nominatim and Photon on independent truth: benchmark. Try it without installing: the live demo (pick Mexico in the list), or the Colab notebook (set COUNTRY = "mx").