[postgis-users] New to PostGIS - Simple Question

Peter webwiz at pl.net
Thu May 26 11:50:35 PDT 2011


I cant help with a C abstraction, of course there will be such a thing, but a single query to get both lat and long of a point is:

SELECT ST_X(the_geom), ST_Y(the_geom) FROM mypoints

-- or

SELECT ST_ASTEXT(the_geom) FROM mypoints

-- and parse the returned "POINT(long lat)"

P.



SixDegrees wrote:
>
> I'm quite new to GIS in general and PostGIS/Postgres in particular. I have to
> write a C/C++ routine to dredge values out of an existing PostGIS-enabled
> database. For the most part, this seems straightforward, but I can't figure
> out how to access the members of types stored as points.
>
> I'm aware of the ST_X() and ST_Y() SQL functions, but it using these seems
> to require two queries. Is it possible to extract the point type into a
> C/C++ struct/class with one call to the DB and process the results, or do I
> have to make two calls for each point? I can't seem to find a PostGIS API;
> does such a thing exist?
>
> A short example would be much appreciated, if possible.
>
> Thank you.




More information about the postgis-users mailing list