[gdal-dev] Differences in behavior between pgsql query and use of GDAL API

Alexandre Gacon alexandre.gacon+gdal at gmail.com
Mon Jun 13 03:52:53 EDT 2011


Hi,

I need to do the following request to find some data:

- I have a bunch of towns (let's call them group A)
- I retrieve the towns touching the group A (let's call them group B)
- I make the union of group A and group B
- I ask the towns covered by the resulting union

For the moment, I use GDAL to do the processing like that:

- I use OGRGeometry::Union to make the union of group A towns
- I send a request to a postgis database with a ST_Touches where clause and
the group A geometry as WKT
- I make the union of the resulting geometries with OGRGeometry::Union
- I send a request to a postgis database with a ST_Covers where clause and
the union of group A and group B as WKT

My problem is that I don't retrieve all the towns I initially have to build
my geometry.

If I try to do the same request totally in pgsql (union, touches and
covers), I have the awaited result. If I compare the area of the geometry of
the ST_Covers where clause (between generation with GDAL and computation by
postgis), I ha ve the same area.

What could explain the difference in the result ? Precision loss in GDAL ?
Precision loss because of the use of WKT ? Should I use WKB instead of WKT ?
Should I do all my computations in postgis ?

-- 
Alexandre Gacon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110613/9e7344b5/attachment.html


More information about the gdal-dev mailing list