Instituto Chico Mendes de Conservação da Biodiversidade (ICMBio)¶
In [1]:
Copied!
from owslib.wfs import WebFeatureService
from owslib.wms import WebMapService
import open_geodata as geo
from owslib.wfs import WebFeatureService
from owslib.wms import WebMapService
import open_geodata as geo
In [2]:
Copied!
import tempfile
from io import BytesIO
from pathlib import Path
import geopandas as gpd
import tempfile
from io import BytesIO
from pathlib import Path
import geopandas as gpd
Pooch¶
Os dados do CNUC está disponíveis de formas diferentes: a primeira delas é o Portal de Dados Abertos do Governo Federal. E, portanto, com auxílio do Pooch foi possível baixar.
In [ ]:
Copied!
db = geo.data.DB(db='br_icmbio')
db.list_data
db = geo.data.DB(db='br_icmbio')
db.list_data
In [ ]:
Copied!
filename = db.get_data(name='tab.ucs_dados')
filename
filename = db.get_data(name='tab.ucs_dados')
filename
In [ ]:
Copied!
df = geo.load_dataset(
db='br_icmbio',
name='tab.ucs_dados',
skiprows=4,
)
df.info()
df.head(2)
df = geo.load_dataset(
db='br_icmbio',
name='tab.ucs_dados',
skiprows=4,
)
df.info()
df.head(2)
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.limite_gerências_regionais_icmbio',
)
gdf.info()
gdf.head()
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.limite_gerências_regionais_icmbio',
)
gdf.info()
gdf.head()
In [ ]:
Copied!
gdf.explore()
gdf.explore()
In [ ]:
Copied!
filename = db.get_data(name='admin.sedes_bases_gerências_regionais')
filename
filename = db.get_data(name='admin.sedes_bases_gerências_regionais')
filename
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.sedes_bases_gerências_regionais',
)
gdf.info()
gdf.head()
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.sedes_bases_gerências_regionais',
)
gdf.info()
gdf.head()
In [ ]:
Copied!
gdf.explore()
gdf.explore()
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.sedes_bases_centros_nacionais_pesquisa_conservação',
)
gdf.info()
gdf.head()
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.sedes_bases_centros_nacionais_pesquisa_conservação',
)
gdf.info()
gdf.head()
In [ ]:
Copied!
gdf.explore()
gdf.explore()
In [ ]:
Copied!
filename = db.get_data(name='admin.centro_formacao_conservacao_biodiversidade')
filename
filename = db.get_data(name='admin.centro_formacao_conservacao_biodiversidade')
filename
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.centro_formacao_conservacao_biodiversidade',
shapefile='ACADEBIO_shp/ACADEBIO.shp',
)
gdf.info()
gdf.head()
gdf = geo.load_dataset(
db='br_icmbio',
name='admin.centro_formacao_conservacao_biodiversidade',
shapefile='ACADEBIO_shp/ACADEBIO.shp',
)
gdf.info()
gdf.head()
In [ ]:
Copied!
gdf.explore()
gdf.explore()
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='temáticos.áreas_embargadas',
engine='fiona',
)
gdf.info()
gdf.head(2)
gdf = geo.load_dataset(
db='br_icmbio',
name='temáticos.áreas_embargadas',
engine='fiona',
)
gdf.info()
gdf.head(2)
In [ ]:
Copied!
gdf.explore()
gdf.explore()
In [ ]:
Copied!
gdf = geo.load_dataset(
db='br_icmbio',
name='temáticos.autos_infração',
engine='fiona',
)
gdf.info()
gdf.head(2)
gdf = geo.load_dataset(
db='br_icmbio',
name='temáticos.autos_infração',
engine='fiona',
)
gdf.info()
gdf.head(2)
In [ ]:
Copied!
gdf.explore()
gdf.explore()
Layers: RPPNs¶
"geo": {
"rppns": {
"url": "https://sistemas.icmbio.gov.br/simrppn/publico/rppn/shp/",
"hash": null,
"description": "RPPNs",
"details": "https://sistemas.icmbio.gov.br/simrppn/publico/"
}
},
Outros¶
DESENVOLVER. NÃO TIVE SUCESSO ATÉ O MOMENTO.
A outra forma é explorar o MapServer que dá sustentação ao portal do CNUC.
https://demo.mapserver.org/cgi-bin/msautotest?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
https://cnuc-mapserv.mma.gov.br/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
In [ ]:
Copied!
wfs = WebFeatureService(
# url='https://geoserver.funai.gov.br/geoserver/ows/',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/biorregioes.map&SERVICE=WMS&REQUEST=GetCapabilities',
url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/florestaspublicas.map&',
#
# version='1.3.0',
# version='2.0.0',
)
wfs = WebFeatureService(
# url='https://geoserver.funai.gov.br/geoserver/ows/',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/biorregioes.map&SERVICE=WMS&REQUEST=GetCapabilities',
url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/florestaspublicas.map&',
#
# version='1.3.0',
# version='2.0.0',
)
In [ ]:
Copied!
wms = WebMapService(
# url='https://geoserver.funai.gov.br/geoserver/ows/',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/biorregioes.map',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/florestaspublicas.map&',
url='http://mapas.mma.gov.br/i3geo/ogc.php?tema=undefined', # i3geo
#
version='1.3.0',
# version='2.0.0',
)
wms = WebMapService(
# url='https://geoserver.funai.gov.br/geoserver/ows/',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/biorregioes.map',
# url='http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/florestaspublicas.map&',
url='http://mapas.mma.gov.br/i3geo/ogc.php?tema=undefined', # i3geo
#
version='1.3.0',
# version='2.0.0',
)
In [ ]:
Copied!
for layer_name, layer in wms.contents.items():
# if layer.queryable == 0:
print(f"Layer: {layer_name}")
print(f" Title: {layer.title}")
print(f" Abstract: {layer.abstract}")
print(f" BoundingBox: {layer.boundingBoxWGS84}")
print(f" CRS: {layer.crsOptions}")
print(f" Styles: {layer.styles}")
print(f" Keywords: {layer.keywords}")
# print(f" Queryable: {layer.queryable}")
# print(f" Opaque: {layer.opaque}")
# print(f" Dimensions: {layer.dimensions}")
print(f" MetadataURLs: {layer.metadataUrls}")
print()
for layer_name, layer in wms.contents.items():
# if layer.queryable == 0:
print(f"Layer: {layer_name}")
print(f" Title: {layer.title}")
print(f" Abstract: {layer.abstract}")
print(f" BoundingBox: {layer.boundingBoxWGS84}")
print(f" CRS: {layer.crsOptions}")
print(f" Styles: {layer.styles}")
print(f" Keywords: {layer.keywords}")
# print(f" Queryable: {layer.queryable}")
# print(f" Opaque: {layer.opaque}")
# print(f" Dimensions: {layer.dimensions}")
print(f" MetadataURLs: {layer.metadataUrls}")
print()
In [ ]:
Copied!
# Obter os dados no formato GeoJSON (ou outro formato suportado)
response = wms.getfeature(
typename='estadosl',
# bbox=(173700, 440400, 178700, 441400),
# srsname='EPSG:28992'
# srsname='EPSG:4326',
# srsname='EPSG:4674',
# outputFormat='application/json',
)
response
# Obter os dados no formato GeoJSON (ou outro formato suportado)
response = wms.getfeature(
typename='estadosl',
# bbox=(173700, 440400, 178700, 441400),
# srsname='EPSG:28992'
# srsname='EPSG:4326',
# srsname='EPSG:4674',
# outputFormat='application/json',
)
response