[postgis-users] New to PostGIS - Simple Question

Charles Galpin cgalpin at lhsw.com
Thu May 26 11:42:12 PDT 2011


I think he's asking for

select st_x(pointcol) as x, st_y(pointcol) as y from his_table;

hth
charles

On May 26, 2011, at 2:40 PM, Paul Ramsey wrote:

> If you have byte-level chops then the most efficient call would be to
> ask for ST_AsBinary(geom) and then handle the well-known-binary byte
> array on your end.  There's some WKB example code in the source repo,
> and also in the MapServer PostGIS connector. But it's a pretty easy
> format.
> 
> P.
> 
> On Thu, May 26, 2011 at 11:30 AM, SixDegrees <paulcarlisle at comcast.net> 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.
>> --
>> View this message in context: http://old.nabble.com/New-to-PostGIS---Simple-Question-tp31710695p31710695.html
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list