-
Notifications
You must be signed in to change notification settings - Fork 283
Enhance datatype determination and improve service_ok
util
#994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance datatype determination and improve service_ok
util
#994
Conversation
Hi @geographika. Maybe you can have a look at this. 👋 |
Thanks (and hi!) @KaiVolland - a very nice addition. I've been testing the branch using import json
from owslib.wfs import WebFeatureService
WFS_SERVICE_URL = 'https://geoportal.stadt-koeln.de/arcgis/services/basiskarten/adressen_stadtteil/MapServer/WFSServer?SERVICE=WFS&request=GetCapabilities'
wfs = WebFeatureService(WFS_SERVICE_URL, version="2.0.0")
schema = wfs.get_schema('adressen_stadtteil:Blumenberg')
print(json.dumps(schema, indent=4)) Output: {
"properties": {
"objectid": "int",
"Nummer": "string",
"Adresse": "string",
"Strassenschl\u00fcssel": "string",
"Stra\u00dfe": "string",
"Amtl._Stra\u00dfenname": "string",
"Stra\u00dfe__Stadtbezirk_": "string",
"Hausnummer": "string",
"Geb\u00e4ude_ID_ALKIS": "string",
"Nutzung__ALKIS_Geb\u00e4udefunktion_": "string",
"Blockseite": "string",
"Stadtviertel__Nr._": "string",
"Stadtviertel": "string",
"Statistisches_Quartier__Nr._": "string",
"Statistisches_Quartier": "string",
"Stadtteil__Nr._": "string",
"Stadtteil": "string",
"Stadtbezirk__Nr._": "string",
"Stadtbezirk": "string",
"Stimmbezirk": "string",
"Postleitzahlgebiet": "string",
"Schiedsamtsbezirk": "string",
"Sozialraum__Nr._": "string",
"Sozialraum": "string",
"globalid": "string"
},
"required": [
"objectid",
"globalid"
],
"geometry": "Point",
"geometry_column": "shape"
} If I try and run the code without your PR I'm getting errors, so I guess this also fixes errors with missing types?
For mocking server results an option is to use I'm also fine with the monkeypatch approach. It would be nice to get another sample test with a few other datatypes if you have one - most of the current example are I'm +1 on merging, but will leave open for a few days to see if anyone else has feedback. |
Thanks for the feedback. I parametrized the data_type tests to cover more cases. I kept the new test (tests/test_wfs_schema_arcgis_server.py) similiar to the existing one so i used the monkey test. 🙂 |
Merging - thanks @KaiVolland. |
This PR contains two enhancements.
The datatype determination for featuretype attributes is updated to support all possible variants of the GML spec. Currently only the simplest case (
<xsd:element minOccurs="0" maxOccurs="1" name="objectid" type="xsd:int"/>
) is supported.The
service_ok
util now usesrequests.get
withstream=True
. This adds support for a known bug in ArcGIS servers where the response header of theHEAD
request response with the wrongcontent-type
.stream=True
should ensure, that there is no data fetched with the request. The traffic should be almost the same as with theHEAD
request.