geopython / pywps

PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
https://pywps.org
MIT License
178 stars 117 forks source link

fix JSON encoding of CRS type (#610) #650

Closed geotom closed 2 years ago

geotom commented 2 years ago

Overview

Fixed the JSON encoding of the CRS type which crashed an execution request when the request was serialized

Related Issue / Discussion

This should fix the problem described in #610

Additional Information

The type owslib.crs.Crs cannot be encoded by the default JSON encoding

Contribution Agreement

(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.08%) to 81.222% when pulling da2d8babb9786c283934d30c6c36b29684fe820f on geotom:issue-610 into 7f228ff17594912664073a629b2c2ed9d4f5f615 on geopython:main.

geotom commented 2 years ago

Yes, I will add a coverage test for this. Latest next week

geotom commented 2 years ago

New changes to my branch: issue-610

Hi @cehbrecht: I have added tests and also fixed the issue at the source of the problem, which was: When parsing BBox inputs, a owslib BoundingBoxwas created and its crs property was simply set as input['crs']. The problem is that the crs propery of the BoundingBox is of the type owslib.crs.Crs. This lead to a failing JSONEncoder. I removed the check in the JSONEncoder and made now sure that the crs is properly set as string when doing the input parsing.

cehbrecht commented 2 years ago

@geotom @tomkralidis should we use getcodeurn() instead of str(bbox.crs)?: https://github.com/geopython/OWSLib/blob/2f55bee4514ab114ab43b5495d719c66fd5dce79/owslib/crs.py#L1848

geotom commented 2 years ago

The difference between getcodeurn() instead of str(bbox.crs) is probably cosmetic as str() indirectly calls exactly this method. Not sure what you'd prefer.

tomkralidis commented 2 years ago

+1 to use getcodeurn().

geotom commented 2 years ago

I changed it accordingly and also removed the comment from it. I hope we can move forward.

cehbrecht commented 2 years ago

@geotom ... test is failing now. None value of bbox.crs is not handled.

geotom commented 2 years ago

Should not fail anymore @cehbrecht

cehbrecht commented 2 years ago

@geotom thanks :)