The Postal Address Code , CEP (or ZIP code ) of the addresses of a city guarantee greater reliability to the address data and the resolution of geolocation by address … Remembering that an address is not only suitable for sending a letter by mail, it is essential complement to the registration of an individual (location even if approximate to where he resides) or legal entity (address of the company's headquarters), present in databases of CRMs, ERPs, etc. and standards such as vCard , Schema , and hundreds of others.
The question is "Where is my city data?" , and may have a specific answer for each Portuguese-speaking country, as well as, eventually, for each city (!), as cities have a certain autonomy on the subject. As I took the city of Campinas as an example, it is suggested that we restrict discussions to Campinas.
In the case of Brazil, the data are neither the responsibility of the IBGE nor the responsibility of the City Hall, despite the City Hall being responsible for the "baptism laws" of each street name in the city ( Campinas street example ).
Geonames has been trying to build an outline of this database, but it doesn't solve it.
OpenStreetMap appears to have a data piece (!). In fact, the ideal for the CEP is to have it spatialized (given a geographic coordinate of the city, return the CEP of the coordinate).
The National Address Directory (DNE) is the database maintained by the Empresa Brasileira de Correios e Telegrafos (ECT), better known as "Correios" do Brasil, to validate postal addresses and determine zip codes. It cannot be on a basis supported by CKAN or any other Open Data initiative.
Unfortunately, all available information points to the answer that there is no open, up-to-date, and reliable zip code database .
According to Wikipedia , Correios created and maintains the zip code base, that is, it belongs to the company, it is not public information by default.
Up-to-date and reliable foundation
As can be consulted by anyone on the Correios website, the official electronic database and its updates can be purchased as a product called DNE . The website description says:
It is the official and exclusive basis of Correios, therefore, the information is reliable and updated.
The initial cost (as of 04/2015) ranges from BRL 1,100.00 to BRL 2,100.00, excluding renewals to receive quarterly registration updates.
According to the product details , the base is available in two formats:
- Text file (.txt)
- Microsoft Access Database (.mdb)
Other companies can acquire the CEPs base and make available services for consultation, paid or free. However, they are directly dependent on post office updates. See this article , for example.
Particularly, I find it difficult to find a free updated base, as the owner would have to bear the costs of the product and updates from the Post Office and still maintain a high availability Web Service.
Some websites and even blogs provide databases for download. However, these databases cannot be considered reliable or up-to-date, as there is no guarantee that the data is actually correct and that the database updates represent the latest updates from the post office.
I don't know the legal implications, but I believe that some of these solutions are illegal, if they are just making the database sold by the post office available in another format.
There are now reliable and up-to-date but paid zip code sources (Correios) and open but untrusted and perhaps not up-to-date sources (other sites).
For companies, for example those that work with virtual stores, the investment in the Correios base would be the best way out.
For personal projects, using a less reliable base would be quite acceptable, especially if there is the possibility of manual updating when necessary.