AtlasOfLivingAustralia / layers-store

API for access to spatial layers (grids and polygons)
3 stars 7 forks source link

POINT SQL query invalid #5

Closed ansell closed 6 years ago

ansell commented 6 years ago

There is an invalid SQL query involving a point which is appearing in the ala-maps log files:

Feb 05, 2018 6:29:04 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/layers-service] threw exception [Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT id, object_id, name, type, latitude, longitude, bearing, user_id, description, focal_length_millimetres from points_of_interest WHERE ST_DWithin(ST_GeographyFromText('POINT(149.12444 -35.30821'), geography(the_geom), ?)]; SQL state [XX000]; error code [0]; ERROR: parse error - invalid geometry
  Hint: "POINT(149.12444 -35.30821" <-- parse error at position 25 within geometry; nested exception is org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry
  Hint: "POINT(149.12444 -35.30821" <-- parse error at position 25 within geometry] with root cause
org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry
  Hint: "POINT(149.12444 -35.30821" <-- parse error at position 25 within geometry
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

The key line is https://github.com/AtlasOfLivingAustralia/layers-store/blob/18f0961646251f074e198f2a322792ecb5ec6f3b/src/main/java/au/org/ala/layers/dao/ObjectDAOImpl.java#L906