1

I am running PostgreSQL and PostGIS. I am trying to do something mind-numbingly simple: determine the latitude and the longitude of a point.

Unfortunately, PostGIS stubbornly refuses to transform the SRID of the GIS data from SRID=4269 to SRID=4326, which is necessary to get the latitude and longitude of the point in question:

select pid, landdistri, ST_AsText(ST_Centroid(geom)) from "parcels_new" where pid='016-626-331';
     pid     |       landdistri        |                st_astext                 
-------------+-------------------------+------------------------------------------
 014-626-331 | Similkameen Div of Yale | POINT(1461547.22664562 504522.034305431)
(1 row)

select pid, landdistri, ST_SRID(geom) from "parcels_new" where pid='016-626-331';
     pid     |       landdistri        | st_srid 
-------------+-------------------------+---------
 014-626-331 | Similkameen Div of Yale |    4269
(1 row)

select pid, landdistri, ST_SRID(ST_Transform(geom, 4326)) from "parcels_new" where pid='016-626-331';
     pid     |       landdistri        | st_srid 
-------------+-------------------------+---------
 014-626-331 | Similkameen Div of Yale |    4326
(1 row)

select pid, landdistri, ST_AsText(ST_Centroid(ST_Transform(geom, 4326))) from "parcels_new" where pid='016-626-331';
     pid     |       landdistri        |                st_astext                 
-------------+-------------------------+------------------------------------------
 014-626-331 | Similkameen Div of Yale | POINT(1461547.22664562 504522.034305431)
(1 row)

select pid, ST_AsEWKT(ST_Centroid(ST_Transform(geom, 4326))) from "parcels_new" where pid='016-626-331';
     pid     |                     st_asewkt
-------------+----------------------------------------------------
 016-626-331 | SRID=4326;POINT(1461547.22664562 504522.034305431)
(1 row) 

select f_table_name as name, srid from geometry_columns;
    name     | srid
-------------+------
 parcels_new | 4269
 Pins        |    0
(2 rows)

I don't get any error messages. I am at a loss to understand why ST_Transform REFUSES TO TRANSFORM my data....

5

You have loaded your data with the wrong SRID. 4269 is lon/lat NAD 83. 4326 is lon/lat WGS 84. They are practically the same projection, and both geographic. Judging from your coordinates, the data is actually in some planar projection, though without knowing extra information (like where you are) I can't even take an informed guess as to which one.

  • 2
    Although, given your use of the term "PID" and your VanCity nick, I'd be willing to hazard that you actually want SRID = 3005 (BC Albers). – Paul Ramsey May 2 '13 at 18:32
  • 1
    So a quick test: SELECT ST_AsText(ST_Transform(ST_SetSRID('POINT(1461547.22664562 504522.034305431)'::geometry,3005), 4326)); – Paul Ramsey May 2 '13 at 18:33
  • 1
    Returns POINT(-119.641455676283 49.3703553898924), which seems to be close to Vancouver. – Paul Ramsey May 2 '13 at 18:34
  • I also referenced this helpful webpage to figure out how to 'fix' my table, now that you figured out what was wrong with it: stackoverflow.com/questions/3012723/… – VanCity May 2 '13 at 18:53

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.