Maxime,
Thank for your answer. This is *useful* information indeed!.
IMHO, given a more complete example (like mentioning the #includes of
the necessary headers and perhaps showing how to deal with one or more
of the primitives (points, linestrings, etc) ) this information *should*
make part of the 5th chapter PostGIS Manual!
BR,
Pedro.
On 11/24/2009 08:58 AM, Maxime van Noppen wrote:
Pedro Doria Meunier wrote:
How does one deal with Postgis geom fields in C++ ?
Google hasn't offered much help so far.
Hi, I know you got a better answer to your problem but just in case it
might help someone here is how I transfer data from postgis to libpq / C++ :
{
pqxx::connection db("host=.... dbname=... user=...");
pqxx::work xaction(db, "gis");
const pqxx::result& res = xaction.exec("SELECT geom FROM sometable;");
// by default, geom is in WKB
std::istringstream istr(res[0].c_str());
geos::geom::GeometryFactory factory;
geos::io::WKBReader wkbr(factory);
geos::geom::Geometry* geom = wkbr.readHEX(istr);
// use geom.
std::cout<< "geom is a "<< geom->getGeometryType()<< std::endl;
delete geom;
}
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users