5

My question is probably amazinlgy stupid, but I can't find the answer myself.

I would like to extract from a database the latitude and longitude of points. For now, I'm getting x(the_geom) and y(the_geom), and I would like to know what is the coordinate system of the results I get.

How can I know this?

12

To get the coordinate system of your table use the following:

SELECT ST_SRID(the_geom) FROM your_table_name LIMIT 1;

For your second question, I am not sure if EPSG:4283 is by default defined in spatial_ref_sys table. In case it is not, you can use a INSERT command. This definition is from spatialreference.org:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 94283, 'epsg', 4283, '+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs ', 'GEOGCS["GDA94",DATUM["Geocentric_Datum_of_Australia_1994",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6283"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4283"]]');

Now use the ST_Transform(the_geom,4283) command.

  • Thank you very much for your answer. I was able to extract the SRID (900913). – Antonin Apr 15 '12 at 12:30
  • I decomposed the question in two parts. The second part of the question is now available here – Antonin Apr 15 '12 at 13:14
  • 1
    Generally you would populate the table using spatial_ref_sys.sql, which also includes EPSG:4283 (SRID=4283 or GDA94 -- Australia) ... I honestly think you intended EPSG:4326 ... furthermore, your instructions would require ST_Transform(the_geom, 94283) to work. – Mike T Apr 15 '12 at 21:34

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.