All Projects → cuducos → brazilian-cities

cuducos / brazilian-cities

Licence: Unlicense license
A script to generate list with all Brazilian cities and states

Programming Languages

python
139335 projects - #7 most used programming language

Load Brazilian cities and states from IBGE

This is a simple script to build a list of Brazilian cities and states from IBGE (using Cidades portal).

Usage

This script requires Python 3.5 or newer, and no external dependencies.

Run $ python cities.py and you'll have 4 new files: cities.csv, cities.json, states.csv and states.json.

File formats

CSV

Cities

code,name,state
520005,Abadia de Goiás,GO
310010,Abadia dos Dourados,MG
520010,Abadiânia,GO
…

States

code,abbr,name
12,AC,Acre
27,AL,Alagoas
16,AP,Amapá
…

JSON

Cities

[
  {
    "name": "Abadia de Goiás",
    "code": "520005",
    "state": "GO"
  },
  {
    "name": "Abadia dos Dourados",
    "code": "310010",
    "state": "MG"
  },
  {
    "name": "Abadiânia",
    "code": "520010",
    "state": "GO"
  },
  
]

States

[
  {
    "name": "Acre",
    "abbr": "AC",
    "code": "12"
  },
  {
    "name": "Alagoas",
    "abbr": "AL",
    "code": "27"
  },
  {
    "name": "Amapá",
    "abbr": "AP",
    "code": "16"
  },
  
]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].