Last active
August 18, 2024 13:54
-
-
Save lsdr/dc3fcd9594bced95aa7ff76f8faa98be to your computer and use it in GitHub Desktop.
Carregando dados do IBGE no PostGIS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download dos shapefiles do IBGE | |
curl -s 'ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2016/Brasil/BR/BR.zip' -o BR.zip | |
# abrir o pacote | |
unzip -j BR.zip | |
# instala o postgresql e o postgis | |
brew install postgis | |
# inicia o postgresql | |
brew services start postgresql | |
# converte shapefile para SQL | |
shp2pgsql -c -D -i -I BRMUE250GC_SIR geo.municipios > load_muni.sql | |
shp2pgsql -c -D -i -I BRMIE250GC_SIR geo.microrregioes > load_micro.sql | |
shp2pgsql -c -D -i -I BRMEE250GC_SIR geo.mesorregioes > load_meso.sql | |
shp2pgsql -c -D -i -I BRUFE250GC_SIR geo.uf > load_uf.sql | |
# carrega dados do shapefile no PostGIS | |
psql -d postgres -f load_muni.sql | |
psql -d postgres -f load_micro.sql | |
psql -d postgres -f load_meso.sql | |
psql -d postgres -f load_uf.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment