[postgis-users] C++ and Postgis

Paul Ramsey pramsey at opengeo.org
Mon Nov 23 13:50:39 PST 2009


That depends entirely on what you're planning to do with them once you
get them. You'll probably want to serialize them into a known form so
you can use them on the client side. ST_AsText() is one, very heavy,
option. Mapserver, to take an example, uses
encode(ST_AsBinary(ST_Force2D(geom)), 'hex'), so what goes over the
wire is hex strings, but those are easy to turn into binary arrays, in
WKB format, suitable for reading by a number of C++ libraries (like
OGR or GEOG or etc).

Best,

P.

On Mon, Nov 23, 2009 at 1:19 PM, Pedro Doria Meunier
<pdoria at netmadeira.com> wrote:
> Hi All,
>
> First off sorry for cross-posting. I'm hoping for a bigger audience... :]
>
> As for my question:
>
> How does one deal with Postgis geom fields in C++ ?
> Google hasn't offered much help so far.
>
> I know I can make a "SELECT astext(my_geom) FROM my_table" and after parsing
> the resulting text.
> This seems a bit awkward and time-consuming...
>
> Is there a better way to deal with it?
>
> Already thankful for any ideas,
> BR,
> Pedro.
> _______________________________________________
> 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