[gdal-dev] Geopackage precision issues

Markus Metz markus.metz.giswork at gmail.com
Wed May 22 00:02:53 PDT 2019


On Tue, May 21, 2019 at 10:16 PM Even Rouault <even.rouault at spatialys.com>
wrote:
>
> Makus,
>
> > Extents and spatial filter settings with Geopackage are unprecise such
that
> > they are unusable.
> >
> > For example I created a Geopackage with a single point: 176418.99585285,
> > 317579.62751027
> > ogrinfo reports extents of
> > Extent: (176419.000000, 317580.000000) - (176419.000000, 317580.000000)
> > I think this can happen if the coordinates are converted to float or
> > converted to a string with something like %.6g or %.g.
>
> Ah indeed. Fixed per
>
https://github.com/OSGeo/gdal/commit/0f28425fe8a2c70061b8896748f40182aff3f2ee

Thanks for the quick fix! BTW, there are many more instances of %g in other
OGR drivers, not sure if some of them need adjustment as well.
>
> > Thus the point in the Geopackage is outside the extents of the
Geopackage.
> > If I adjust the extents of the Geopackage to
> > minx: 176418.823581
> > maxx: 176419.176419
> > miny: 317579.682420
> > maxy: 317580.317580
> > and use this as a spatial filter, the point is still excluded.
>
> Yes, that's expected: your miny_filter > y_geometry. You probably meant
> miny=317579.582420

Oops, yes of course, that works, that means it was only the extents
suffering from loss of precision.

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190522/5702fb76/attachment.html>


More information about the gdal-dev mailing list