Dwithin spatial_query bug - don't check units and always puts degrees
- Dominant language
- Python
- Stars
- 240
- Forks
- 179
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 10
Description
When a CSW GetRecords request is run against a PostgreSQL backend and uses Dwithin spatial_query, the query that is generated to PostgreSQL is in "degree" units instead of "metres" as requested
**Problem Description**
When querying the PYCSW with the dwithin spatial_query, for example:
ows:BoundingBox
23.7342660 37.974720
50
When pycsw translates the query, it ignores the Distance units="meters"
From:
https://github.com/geopython/pycsw/blob/9b9afc9a4b6dbc4ba68d071262fdcce8eaa039b9/pycsw/ogc/fes/fes2.py#L375
We need to change the generated query from:
`WHERE st_dwithin(wkb_geometry, st_geomfromtext('POINT(23.7342660 37.974720)',4326), 50.000000) = 'true'`
To:
`WHERE st_dwithin(wkb_geometry::geography, st_geomfromtext('POINT(23.7342660 37.974720)',4326)::geography, 50.000000) = 'true'`
Contributor guide
Assessment
This issue has not been assessed yet.