I am trying to download some Dutch open data through a WFS, but I get a DriverError. It seems to be a geopandas problem, but I cannot find or think of a solution. I'll provide my code below and hopefully someone can identify my problem.
Code (optained from this question: Reading data to geopandas using WFS?):
from requests import Request
from owslib.wfs import WebFeatureService
# URL for WFS backend
url = "https://geodata.nationaalgeoregister.nl/natura2000/wfs?request=GetCapabilities&service=wfs"
# Initialize
wfs = WebFeatureService(url=url)
# Get data from WFS
# -----------------
# Fetch the last available layer (as an example) --> 'vaestoruutu:vaki2017_5km'
layer = list(wfs.contents)[-1]
# Specify the parameters for fetching the data
params = dict(service='WFS', version="1.0.0", request='GetFeature',
typeName=layer, outputFormat='json')
# Parse the URL with parameters
q = Request('GET', url, params=params).prepare().url
# Read data from URL
data = gpd.read_file(q)
The error message:
22 q = Request('GET', url, params=params).prepare().url
24 # Read data from URL
---> 25 data = gpd.read_file(q)
File ~\Anaconda3\envs\PDOK\lib\site-packages\geopandas\io\file.py:160, in _read_file(filename, bbox, mask, rows, **kwargs)
157 reader = fiona.open
159 with fiona_env():
--> 160 with reader(path_or_bytes, **kwargs) as features:
161
162 # In a future Fiona release the crs attribute of features will
163 # no longer be a dict, but will behave like a dict. So this should
164 # be forwards compatible
165 crs = (
166 features.crs["init"]
167 if features.crs and "init" in features.crs
168 else features.crs_wkt
169 )
171 # handle loading the bounding box
File ~\Anaconda3\envs\PDOK\lib\site-packages\fiona\collection.py:555, in BytesCollection.__init__(self, bytesbuf, **kwds)
552 self.virtual_file = buffer_to_virtual_file(self.bytesbuf, ext=ext)
554 # Instantiate the parent class.
--> 555 super(BytesCollection, self).__init__(self.virtual_file, vsi=filetype, **kwds)
File ~\Anaconda3\envs\PDOK\lib\site-packages\fiona\collection.py:171, in Collection.__init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
168 raise
170 if self.session is not None:
--> 171 self.guard_driver_mode()
173 if self.mode in ("a", "w"):
174 self._valid_geom_types = _get_valid_geom_types(self.schema, self.driver)
File ~\Anaconda3\envs\PDOK\lib\site-packages\fiona\collection.py:188, in Collection.guard_driver_mode(self)
186 driver = self.session.get_driver()
187 if driver not in supported_drivers:
--> 188 raise DriverError("unsupported driver: %r" % driver)
189 if self.mode not in supported_drivers[driver]:
190 raise DriverError("unsupported mode: %r" % self.mode)
DriverError: unsupported driver: 'WFS'
I am quite new to this.