[postgis-users] Accessing points externally

Pavel Iacovlev iacovlev.pavel at gmail.com
Tue Aug 18 09:33:37 PDT 2009


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<facundofc at gmail.com> 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
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
http://iap.md, The future is open



More information about the postgis-users mailing list