Now quite sure what you need but here I go: SELECT st_x(my_point_field) as x, st_y(my_point_field) as y FROM my_table; will work as you expect ,it will return results that has 2 columns x,y.
You can use this for polygons or any other geometries: st_astext(the_geom) will dump the geometries in WKT format (http://en.wikipedia.org/wiki/Well-known_text), also you an dump as GML or JSON. On Tue, Aug 18, 2009 at 6:18 PM, Facundo Ciccioli<[email protected]> wrote: > Hi. Here at work we are thinking of using PostGIS to store points > indicating locations (in the future we'll need polygons as well). I > was wondering if there is a way to, once I get the Point object stored > in the database (with something like "SELECT my_point_field FROM > my_table;"), query the data returned to obtain the x and y > coordinates. I read the "Simple features" defined by OpenGIS, and if I > understood correctly, it should NOT be possible what I want to do. The > standard states that the Geometry object's attributes should only be > accessed via SQL (in my case it would go "SELECT st_x(my_point_field), > st_y(my_point_field) FROM my_table;"). But as I said: *if I understood > correctly* :P. > > So, is there a way to do this? I guess that what I'm > looking for is a library or something with the functions that access > the internal format of the points as stored in the database, or the > specifications of such format so that we could write a library like > that. > > Thanks in advance. > FaQ > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > -- http://iap.md, The future is open _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
