Zum Hauptinhalt springen

Schlagwort: Geopandas

Creating GeoPandas data frames from WFS urls

Today I learned that you can create a geopoandas data frame object from an WFS request url. Thanks to htenkanen, who gave this detailed stackoverflow answer. Now I know, that if I combine a dict with the relevant WFS params, build a Request object from requests lib, I can compute an well formed GET url to retrieve all features of the WFS.

Since I am living in Germany I tried to find some governmental open-data WFS and applied the answer that htenkanen gave, to its configuration. With the following code, you get all administrative boundaries (de: Verwaltungseinheit) of the federal state Hesse (de: Hessen) as data frame. I highlighted the lines that I needed to change to get it working.

In-memory reading of GML-format data with geopandas

Today I learned another way of parsing geo data formats in-memory, using geopandas.

As part of a running django web service, I wanted to request and parse a WFS respose, which comes back in GML format.

The solution to this is:

gpd.GeoDataFrame.from_features(fiona.BytesCollection(bytes_str))

This was pointed out by sal in this stackoverflow answer. Since I could not find it in the documentation, either in fiona and not in geopandas. I want to try now to add this there.