Skip to content

wfs: Fix error when parsing empty OtherCRS - #1045

Merged
geographika merged 1 commit into
geopython:masterfrom
bierik:handle_empty_crs
Aug 18, 2026
Merged

wfs: Fix error when parsing empty OtherCRS#1045
geographika merged 1 commit into
geopython:masterfrom
bierik:handle_empty_crs

Conversation

@bierik

@bierik bierik commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

According to the official XSD, <OtherCRS /> and <OtherSRS /> are valid for WFS capabilities.
Previously, the Crs tried to split the id, which may be None in this case and resulted in an error.
With this change, both wfs110 and wfs200 reject None values entirely.

According to the official XSD, `<OtherCRS />` and `<OtherSRS />`
are valid for WFS capabilities.
Previously, the Crs tried to split the id, which may be None in this case
and resulted in an error.
With this change, both wfs110 and wfs200 reject None values entirely.
@geographika

Copy link
Copy Markdown
Contributor

Thanks @bierik for the fix and test.

From https://schemas.opengis.net/wfs/2.0/wfs.xsd:

<xsd:element name="OtherCRS" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded"/>

I assume xsd:anyURI allows an empty string so this seems good to me (although the server omitting it would be more logicial).

I presume you ran into this in a real-world use-case. Do you know which server produced the GetCapabilities response?

@bierik

bierik commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@geographika As far as I can tell, xsd:anyURI allows an empty string, which is parsed as None by lxml. I validated the response from the capabilities endpoint that I was having trouble with against the XSD you pointed out, and it turned out to be completely valid.

Unfortunately, the services that produced this response are internal services from the customer. I completely agree with you that these services should omit the empty tags. But for me, it was just easier to fix it in the client library 😄. And if the XSD allows it, the client should handle it, right?

@geographika
geographika merged commit 9c94121 into geopython:master Aug 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants