I need to get all attribute names and all their restrictions of the WFS feature type. The get_schema method of the owslib.wfs WebFeatureService is not working and throwing an error.
Code:
from owslib.wfs import WebFeatureService
wfs = WebFeatureService(url='https://maps.helcom.fi/arcgis/services/MADS/Human_Activities/MapServer/WFSServer', version='2.0.0')
schema = wfs.get_schema('Human_Activities:Dredging_sites_points_36_2')
Error message:
Traceback (most recent call last):
File "C:\...\test.py", line 14, in <module>
schema = wfs.get_schema('Human_Activities:Dredging_sites_points_36_2')
File "C:\...\Lib\site-packages\owslib\feature\__init__.py", line 380, in get_schema
return get_schema(self.url, typename, self.version, auth=self.auth)
File "C:\...\Lib\site-packages\owslib\feature\schema.py", line 62, in get_schema
return _construct_schema(elements, nsmap)
File "C:\...\Lib\site-packages\owslib\feature\schema.py", line 122, in _construct_schema
data_type = element.attrib["type"].replace(gml_key + ":", "")
File "src/lxml/etree.pyx", line 2496, in lxml.etree._Attrib.__getitem__
KeyError: 'type'
The corresponding call for DescribeFeatureType request works fine: https://maps.helcom.fi/arcgis/services/MADS/Human_Activities/MapServer/WFSServer?request=DescribeFeatureType&service=WFS&version=2.0.0&typeNames=Human_Activities:Dredging_sites_points_36_2
What is a problem?
Is there any other way to get WFS feature type schema in Python than using owslib.wfs WebFeatureService get_schema?