tobinbradley/dirt-simple-postgis-http-api

error running query

Closed this issue · 4 comments

i get this error when i use the service for returning geojson or the vector tiles service

{ "error": "error running query", "error_details": { "name": "error", "length": 91, "severity": "ERROR", "code": "XX000", "file": "lwgeom_transform.c", "line": "54", "routine": "transform" } }

while other services work fine, i was able to list tables in my database and return columns in a certain table etc, but what i mostly interested in is the vector tiles which gives that error, any help ?

Hard to say without more details, but a couple of guesses -

  • Did you load your data without specifying a SRID? You can check this by looking at the geometry_columns view. If it says 0 for the srid, that's the problem.
  • Are you sending a valid z/x/y tile spec name or are your bbox coordinates in the correct order and in lat/lng?
  • Does the login have read rights to the geometry_columns table?

My guess is one of the first two. lwgeom_transform.cdoes projection operations as far as I can tell.

thank you, it was the SRID as you mentioned.
my question is for example i have a shapfile with SRID of 32657 which is (WGS 84 / UTM zone 57N)
do i have to set a target SRID of 4326 ( WGS ) for every time i import a shapefile ?

Nope. You should use 32657 (or whatever you want).

Some of the endpoints (like geojson and MVT) need to output data in 4326. That transformation happens automatically from whatever projection your data is stored in. The problem was arising because your data wasn't loaded with a specific SRID, so it didn't know how to transform it to 4326. As long as you load it with the SRID the data is in, you should be good.

great, really thanks for the great work and tutorials on youtube :)