[Gdal-dev] Numerical differences ogr -sql versus postreSQL

Frank Warmerdam warmerdam at pobox.com
Mon Sep 19 15:53:31 EDT 2005

On 9/19/05, Thomas Windholz <thomw00 at yahoo.com> wrote:
> Numerical differences in, for example, buffer: 
> I noticed numerical differences between an sql statement through the ogr
> library versus directly through postgreSQL (I thought the sqlexecute goes
> through?). Has anyone noticed these differences as well? In the following
> dataset these numerical differences produce sort of ears that are equal to
> the radius of the buffer (so not really negligible and quite visible). 


I see what you mean, but I have no idea why this is happening. 
The buffering is happening in PostGIS in both cases.  I have no
idea why some points are altered when read back through OGR.
I don't think I have a geos enabled PostGIS setup here so I can't
easily test the same thing myself. 

If you are in a position to do so, I would suggest stepping through 
the OGR code.   In particular, I suspect should break in 
gdal/ogr/ogrsf_frmts/pg/ogrpglayer.cpp in the RecordToFeature()
method.  There is a spot in a block commented as "Handle PostGIS
geometry" that either calls HEXToGeometry() or createFromWkt().
If it goes through the createFromWkt() it would be interesting to 
see if the Wkt it gets is corrupt already.  However, I suspect it will
got through the HEXToGeometry() method which is pretty new and
might a bug of some sort.   The HEXToGeometry() method is pretty
new, and used (I think) only for user sql requests. 

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list