This line:

ST_AsText(ST_Transform(the_geom, 4326))

Returns the "coordinates" as utm coordinates. Although, I thought ST_Transform was supposed to convert the coordinates from utm to lat/lon. I found a tutorial where the behavior I need is shown in an example: http://postgis.net/workshops/postgis-intro/projection.html

Is there any reason why it would not be doing this?

  • 1
    do you have a srid set on your geometry?
    – atlefren
    Feb 26 '14 at 17:58
  • @atlefren Using Find_SRID() it returns 4326
    – Joel k.
    Feb 26 '14 at 18:03
  • 2
    It may be the_geom is not registered as UTM coordinates, so the transform is presuming there is no transform necessary and just giving you back the coordinates you put in.
    – DPierce
    Feb 26 '14 at 18:07
  • @DPierce Is there an easy way to update my geometry so it registers as UTM? Sorry I am new to this.
    – Joel k.
    Feb 26 '14 at 18:10
  • 1
    check out postgis.org/docs/ST_SetSRID.html
    – atlefren
    Feb 26 '14 at 18:19

Thanks for the help everyone. I guess the all the geometries in my database were set to the wrong SRIDs. The geometries had SRIDs of 4326 when they should have been 3400, and this is why ST_Transform wasn't doing anything.

This is the code that ended up giving me what I wanted:

ST_AsText(ST_Transform(ST_SetSRID(the_geom, 3400), 4326)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.