InseeFrLab / InseeFrLab/cartiflette
Explorer un provider avec l'API carto (en version beta sur les flux du géoportail)
- Dominant language
- Jupyter Notebook
- Stars
- 62
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Pas réussi à attaquer directement les flux WFS (retour systématique d'un "MissingParameter" non précisé).
Ne fonctionne pas :
```
from owslib.wfs import WebFeatureService
url = "https://wxs.ign.fr/geoportail/wfs"
wfs = WebFeatureService(url=url, version='2.0.0')
cog_files = [
x for x in wfs.contents
if 'cog' in x.lower()
and 'carto' in x.lower()
and 'latest' in x.lower()
]
print(wfs.getfeature(cog_files[-1]).read())
```
En revanche, l'appel via l'API carto en version beta fonctionne ; le débit semble beaucoup plus rapide que sur le site de l'IGN (mais les md5 ne sont par contre pas fournis, il faudra les calculer à réception) :
```
from owslib.wfs import WebFeatureService
import geopandas as gpd
import requests
url = "https://wxs.ign.fr/geoportail/wfs"
wfs = WebFeatureService(url=url, version='2.0.0')
cog_files = [
x for x in wfs.contents
if 'cog' in x.lower()
and 'carto' in x.lower()
and 'latest' in x.lower()
]
print(cog_files)
file = cog_files[-1]
bbox_world = """{"type":"Polygon", "coordinates":[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}"""
r = requests.get(
'https://apicarto.ign.fr/api/wfs-geoportail/search',
params={"source":file, "geom":bbox_world}
)
gdf = gpd.GeoDataFrame.from_features(r.json())
gdf.plot()
```
Contributor guide
Assessment
This issue has not been assessed yet.