This post is a compilation of some useful free online resources to obtain geographical information for Mexico, including administrative areas, postal codes, points of interest, etc.
The Mexican Instituto Nacional de Estadística y Geografía (INEGI) website has a large amount of information available for download, in several data sets.
In the URL Cartografía geoestadística urbana – descarga there are links for the download of files in DWG and shapefile formats for each of the municipalities in Mexico. These files contain the definition of the areas that delimit each of the localities in the municipality, and also of the “áreas geoestadísticas básicas” (basic geo-statistical areas) or AGEBs, used in the elaboration of the population census. These files do not include the definition of the areas of the “Asentamientos” (settlements): Colonias, Fraccionamientos, etc. that constitute the main subdivisions of a locality in Mexico.
The sample screenshot above shows the 9 shapefiles included in the download of Nuevo León – Monterrey. The name of the layers is the locality code followed by one to three letters, as follows:
- A – AGEBs
- CA – Roads
- E – Streets
- L – Locality boundaries
- M – Manzanas (Sets of buildings)
- SIA – Areas for squares, parks, schools,…
- SIL – Lines for bridges, waterways, railways,…
- SIP – Points for squares, schools, churches, hospitals, etc.
- T – Text labels for streets
Información Vectorial de localidades urbanas
To download this information, a (free) account must be created, and a request sent to INEGI support. They will provide the user with a link to a web form where a file in shapefile or DWG format can be downloaded for each of more than 1500 towns. The shapefile includes layers which the cartography of AGEBs, “Manzanas” and settlements, as well as the streets and Urban Services.
Here is how it looks opened in qgis:
Many of the layers in this file hold the same kind of information as the layers in the “Urban Cartography” above mentioned. They also follow the same naming convention, with the locality code followed by one or more letters:
- l – locality boundary
- a – AGEBs
- as – Settlements
- m – Manzanas
- fm – Frente de Manzanas
- ne – External Numbering
- sia – Areas for squares, parks, schools,…
- sip – Points for squares, schools, churches, hospitals, etc.
- v – Vialidades (Streets)
Catalogs of Entities (States), Municipalities and Localities
http://www.inegi.org.mx/geo/contenidos/geoestadistica/catalogoclaves.aspx gives access to the download in DBF format of the databases of mexican states, municipalities and localities.
The localities database contains one record per locality, with the names and numerical identifiers of the state, municipality and locality. These numerical identifiers are used in other databases downloadable from INEGI:
- CVE_ENT – Entity (State) ID
- NOM_ENT – Entity (State) name
- NOM_ABR – Entity short name
- CVE_MUN – Municipality ID
- NOM_MUN – Municipality name
- CVE_LOC – Locality ID
- NOM_LOC – Locality name
- LATITUD – Latitude
- LONGITUD – Longitude
- ALTITUD – Altitude
- PTOT – Total population
- PMAS – Total male population
- PFEM – Total female population
- VTOT – Total number of inhabited properties
Catálogo de Asentamientos Humanos (Catalog of Human Settlements)
In the URL
http://www.inegi.org.mx/geo/contenidos/geoestadistica/default.aspx you can find a link for the download of the
Catálogo de Asentamientos Humanos 2004-2010.
The downloaded file is a compressed zip file containing a CSV document with more than 450,000 records. Each record includes a series of fields:
- cve_ent – Entity (State) ID
- cve_mun – Municipality ID
- cve_loc – Locality ID
- cve_asen – Settlement ID
- nom_asen – Settlement name
- cve_tipo_asen – Settlement Type ID
- fecha_act – Date of last update
The settlement type IDs and names (Barrio, Colonia, Fraccionamiento, etc.) are provided in a separate file also included in the zip file downloaded.
Catálogo de Vialidades (Catalog of Streets)
Also in the URL
http://www.inegi.org.mx/geo/contenidos/geoestadistica/default.aspx there is a link for the download of the
Catálogo de Vialidades con clave por localidad.
The zip file downloaded includes a CSV document with 2,341,222 street records. The fields in those records are:
- cve_ent – Entity (State) ID
- cve_mun – Municipality ID
- cve_loc – Locality ID
- cve_via – Street ID
- nom_via – Street name
- cve_tipo_vial – Street Type ID (Calle, Avenida, Callejón,…)
The names of the street types and their IDs are provided as a separate file included in the zip file downloaded.
OpenStreetMap (OSM) is a large geographical information database of the whole world. The database is maintained by thousands of contributors in every country, and it is often considered as the “Wikipedia” of the geographical information.
The information in the OSM DB is structured as a set of nodes (lat/long pairs), ways (ordered sequences of nodes) and relations (sets of nodes, ways and/or other relations, that together constitute a geographical entity). Nodes, ways and relations may have associated tags that provide additional information (name, type, etc.)
In download.geofabrik.de there are country extracts available for download. The latest extract for Mexico at the time of writing this post includes 6.450.330 nodes, 736.331 ways and 2.673 relations. Only 433 of these relations identify administrative boundaries (States, Municipalities and the main localities).
The Callejero de Mexico de OpenAlfa implements a street locator using OSM as the main source. The site displays in a map the location of the street, and the closest available services in the area: restaurants, pharmacies, schools, etc.
The website of the mexican postal service includes a page for the download of postal code information.
At the time of writing this post, the document is updated to October 2013.
The name of the file downloaded is
CPdescargatxt.zip, and contains a text file
CPdescarga.txt in CSV format (there are also links for the download of the document in Excel and XML).
Each record includes the following fields:
- d_codigo – Settlement Postal Code
- d_asenta – Settlement Name
- d_tipo_asenta – Settlement Type (Catálogo SEPOMEX)
- D_mnpio – Municipality Name (INEGI, March 2013)
- d_estado – Entity Name (INEGI, March 2013)
- d_ciudad – Town Name (Catálogo SEPOMEX)
- d_CP – Postal Code of the Post Office responsible for the settlement
- c_estado – Entity ID (INEGI, March 2013)
- c_oficina – ID of the Post Office responsible for the settlement
- c_CP – Empty field
- c_tipo_asenta – Settlement ID (Catálogo SEPOMEX)
- c_mnpio – Municipality ID (INEGI, March 2013)
- id_asenta_cpcons – Unique Settlement ID (at the municipality level)
- d_zona – Zone where the settlement is located (Urban/Rural)
- c_cve_ciudad – Town ID (Catálogo SEPOMEX)
The document contains 144,225 settlement records, in 32,347 distinct postal codes
A file MX.txt in CSV format can be downloaded from the Geonames postal code download page.
The fields in the document are:
- country code : Two-character ISO country code (MX)
- postal code
- place name
- admin name1 : State name
- admin code1 : State code
- admin name2 : Municipality name
- admin code2 : Municipality code
- admin name3 : Town name
- admin code3 : Town code
- latitude : estimated latitude (wgs84)
- longitude : estimatedlongitude (wgs84)
- accuracy : lat/lng coordinate accuracy from 1=estimated to 6=centroid
There are 75,203 records and 29,324 distinct postal codes in the file downloaded.
The www.gadm.org website contains the cartography of the administrative areas of most countries, available for download. The user can choose between several file formats, including shapefile.
The file downloaded for Mexico is named MEX_adm.zip and is 9 MB in size.
There are three sets of files inside the compressed file, for each of the three first administrative levels of Mexico:
- MEX_adm0 – Mexico
- MEX_adm1 – States
- MEX_adm2 – Municipalities
$ unzip MEX_adm.zip Archive: MEX_adm.zip inflating: MEX_adm0.csv inflating: MEX_adm0.dbf inflating: MEX_adm0.prj inflating: MEX_adm0.shp inflating: MEX_adm0.shx inflating: MEX_adm1.csv inflating: MEX_adm1.dbf inflating: MEX_adm1.prj inflating: MEX_adm1.shp inflating: MEX_adm1.shx inflating: MEX_adm2.csv inflating: MEX_adm2.dbf inflating: MEX_adm2.prj inflating: MEX_adm2.shp inflating: MEX_adm2.shx inflating: read_me.pdf
And here is how it looks when opened in qgis: