ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
125 stars 192 forks source link

Update shapely usage to avoid deprecation #276

Closed frafra closed 2 years ago

frafra commented 2 years ago

Work based on PR #272.

frafra commented 2 years ago

The only potential problem I see, is that the error message for an invalid geometry is a bit too generic. shape('{"Type":"Bad_GeoJSON","a":2}') would show AttributeError: 'NoneType' object has no attribute 'lower', which is not so great. An alternative would be to catch AttributeError as an exception and write something like Invalid geometry.

frafra commented 2 years ago

Instead of changing the tests, I changed the error handling in the code, and wrote a meaningful error message.

That seems good enough for me :)

mutantsan commented 2 years ago

Thanks, @frafra ! I couldn't find the time to fix the tests. I'm glad that you found the issue.