[gdal-dev] Fwd: GeoPKG Zoom Level Calculation
Even Rouault
even.rouault at spatialys.com
Wed Sep 13 13:50:01 PDT 2017
On mercredi 13 septembre 2017 15:38:55 CEST Roarke Gaskill wrote:
> Hi,
>
> In the GDALGeoPackageDataset
> <https://github.com/OSGeo/gdal/blob/65dea1c999b6b5f692c945ea074b04cb5e43eca4
> /gdal/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp#L1819> class it
> appears the zoom level in the SetGeoTransform function does not calculate
> the zoom level correctly. Also, it is different from the zoom level
> calculation in CreateCopy
> <https://github.com/OSGeo/gdal/blob/65dea1c999b6b5f692c945ea074b04cb5e43eca4
> /gdal/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp#L4079> function. The
> zoom level calculation in the CreateCopy appears to work as I would expect.
>
> The transform I am using to test is:
> [-20037508.342789248, 6176.637812966647, 0.0, 19971868.880408563, 0.0,
> -6177.590116052211]
>
> The CreateCopy zoom level logic produces level 5. Which is what I would
> expect.
>
> The SetGeoTransform zoom level logic is not able to identify a zoom level.
>
> Is the SetGeoTransform zoom level calculation logic wrong?
Roarke,
when using SetGeoTransform() and a pre-defined tiling scheme (here I assume you must use
GoogleMapsCompatible), the resolution of the geotransform matrix passed to
SetGeoTransform() must exactly match the base resolution of the tiling scheme divided by a
power of 2
>>> 156543.0339280410 / 6176.637812966647
25.344376450147266
which is not a power of 2.
CreateCopy() in the GPKG implementation with a pre-defined tiling scheme identifies the
closest zoom level for your source dataset and then resample it so its resolution matches
exactly one of the zoom levels.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170913/7995784b/attachment.html>
More information about the gdal-dev
mailing list