Defesa Civil¶
O repositório open-geodata/sp_defesacivil_divadmin apresenta uma forma de obter detalhes sobre as Coordenadorias Regionais de Proteção e Defesa Civil (REPDEC) da Defesa Civil do Estado de São Paulo. Usando o pacote open-geodata é possível ler o conteúdo do repositório, com auxílio do pooch.
In [ ]:
Copied!
import tempfile
from pathlib import Path
import open_geodata as geo
import tempfile
from pathlib import Path
import open_geodata as geo
In [ ]:
Copied!
db = geo.data.DB(db='sp_defesa_civil')
db.list_data
db = geo.data.DB(db='sp_defesa_civil')
db.list_data
E selecionamos o que desejamos visualizar.
In [ ]:
Copied!
gdf = geo.data.load_dataset(db='sp_defesa_civil', name='geo.sp_defesa_civil')
# Results
gdf.info()
gdf.head(2)
gdf = geo.data.load_dataset(db='sp_defesa_civil', name='geo.sp_defesa_civil')
# Results
gdf.info()
gdf.head(2)
In [ ]:
Copied!
gdf.explore(column='repdec_regiao')
gdf.explore(column='repdec_regiao')
Criamos uma pasta temporária apenas para demonstrar como podemos salvar o resultado.
In [ ]:
Copied!
temp_path = Path(tempfile.gettempdir()) / 'open_geodata'
temp_path.mkdir(exist_ok=True)
temp_path = Path(tempfile.gettempdir()) / 'open_geodata'
temp_path.mkdir(exist_ok=True)
E salvamos em formatos distintos.
In [ ]:
Copied!
# Salva em Geopackage
gdf.to_file(
temp_path / 'sp_cetesb.gpkg',
layer='sp_cetesb',
driver='GPKG',
)
# Salva em Geojson
gdf.to_file(
temp_path / 'sp_cetesb.geojson',
driver='GeoJSON',
encoding='utf-8',
)
# Salva em Geopackage
gdf.to_file(
temp_path / 'sp_cetesb.gpkg',
layer='sp_cetesb',
driver='GPKG',
)
# Salva em Geojson
gdf.to_file(
temp_path / 'sp_cetesb.geojson',
driver='GeoJSON',
encoding='utf-8',
)