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.
Line 9 needed a explicit version
parameter and line 18 needed typeNames
instead of typeName
.
|
|
Note
To adjust the request dictionary to work with your particular WFS instance, it’s easier to paste the wfs_request_url
into a browser bar (or CLI curl) and maybe get an verbose error message by the called service itself.