This tool is designed for students, researchers, data scientists, or anyone who would like to have access to SICAR files.
- Get cities-codes by state code
- Download city (Shapefile) by code
- Download lists of cities (Shapefile) by code
- Download all cities (Shapefile) in a state by code
- Download the entire country (Shapefile)
- Tesseract driver to automatically detect captcha
- Manual driver to automate the download process
Install SICAR with pip
pip install git+https://github.com/urbanogilson/SICARPrerequisite:
Install Google Tesseract OCR (additional info how to install the engine on Linux, Mac OSX and Windows).
If you don't want to install dependencies on your computer or don't know how to install them, I strongly recommend Google Colab.
from SICAR import Sicar
import pprint
# Create Sicar instance
car = Sicar(email = "name@domain.com")
# Get cities codes in Roraima state
cities_codes = car.get_cities_codes(state='RR')
pprint.pprint(cities_codes)
# {'Alto Alegre': '1400050',
# 'Amajari': '1400027',
# 'Boa Vista': '1400100',
# 'Bonfim': '1400159',
# 'Cantá': '1400175',
# 'Caracaraí': '1400209',
# 'Caroebe': '1400233',
# 'Iracema': '1400282',
# 'Mucajaí': '1400308',
# 'Normandia': '1400407',
# 'Pacaraima': '1400456',
# 'Rorainópolis': '1400472',
# 'São João da Baliza': '1400506',
# 'São Luiz': '1400605',
# 'Uiramutã': '1400704'}
# Download 'Alto Alegre': '1400050'
car.download_city_code('1400050', folder='Roraima')
# Download specific cities
cities_codes = {
'São Gabriel da Cachoeira': '1303809',
'São Paulo de Olivença': '1303908'
}
car.download_cities(cities_codes=cities_codes, folder='cities')
# Download all cities in Roraima state
car.download_state(state='RR', folder='RR')Using Google Colab, you don't need to install the dependencies on your computer and you can save files directly to your Google Drive.
Update the entry point file ./examples/docker.py to download data based on your needs.
Generate docker image
# using the docker build script
./docker-build.shRun to download all data defined in the ./examples/docker.py entry point to an external directory.
Make an external directory to store the downloaded data, /my/local/data/dir, and use a volume parameter in the run command to point to it.
# run the docker image in detached mode
docker run -d --rm -v /my/local/data/dir:/data softwarevale/download-sicar:v0.1- Add support to download csv files
Contributions are always welcome!
If you have any feedback, please reach me at gilson@gilsonurbano.com