Skip to content

Problem with geo.distance #184

@derkod

Description

@derkod

It seems the geo.distance functions does not work anymore.
This can only be the case because of a change in Postgis-functionality because we did not change the GOST-implementation.
The query that is executed is

SELECT A_location.location_id AS A_location_id, A_location.location_name AS A_location_name, A_location.location_description AS A_location_description, A_location.location_encodingtype AS A_location_encodingtype, A_location.location_geojson AS A_location_geojson FROM (SELECT location.id AS location_id, location.name AS location_name, location.description AS location_description, location.encodingtype AS location_encodingtype, location.geojson::text AS location_geojson FROM v1_1.location WHERE ST_DISTANCE(ST_GeomFromGeoJSON(public.ST_AsGeoJSON(location.location)), ST_GeomFromText('POINT(5.0 52.0)')) < 0.05 ORDER BY location_id DESC LIMIT 201 OFFSET 0) AS A_location

This yields an error:
ERROR: ST_Distance: Operation on mixed SRID geometries (Point, 4326) != (Point, 0)

When I add SRID 4326 to ST_GeomFromText I get expected output

SELECT A_location.location_id AS A_location_id, A_location.location_name AS A_location_name, A_location.location_description AS A_location_description, A_location.location_encodingtype AS A_location_encodingtype, A_location.location_geojson AS A_location_geojson FROM (SELECT location.id AS location_id, location.name AS location_name, location.description AS location_description, location.encodingtype AS location_encodingtype, location.geojson::text AS location_geojson FROM v1_1.location WHERE ST_DISTANCE(ST_GeomFromGeoJSON(public.ST_AsGeoJSON(location.location)), ST_GeomFromText('POINT(5.0 52.0)'**,4326**)) < 0.05 ORDER BY location_id DESC LIMIT 201 OFFSET 0) AS A_location

Is there a way to add this SRID in the API call?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions