[gdal-dev] Example about how to save Tiled Gridded Coverage Data into GeoPackage

Even Rouault even.rouault at spatialys.com
Tue May 15 06:04:43 PDT 2018


> Thanks, works well with 32 bit floating point tiffs as source and the gpkg
> DEM opens fine with QGIS 3. I know I can add several DEM tiffs by combining
> them into one datasource with VRT but is there any way to add data into an
> existing raster table? I understand that a general solution would be tricky
> because new data might require to increase the tile matrix, and within the
> existing matrix a well working system should be able to combine and merge
> partial tiles. But is it possible to add data into raster table at all, for
> example by inserting and overwriting tiles in Web Mercator grid?

Jukka,

Extending the limits of an existing tile matrix would require some work (renumbering the 
existing tiles, recomputing overviews, etc...)

But if you use a global tiling system like Web Mercator, you can do it, but it is admitedly a bit 
tricky.

gdalwarp new_data.tif existing.gpkg \
	-doo MINX=... -doo MINY=... -doo MAXX=... -doo MAXY=....

While in theory you could use the exterme value of the Web Mercator projection (+/- 
20037508.34) for those minx, etc values, this would take hours/days to process given how 
gdalwarp works.
So you will have to compute a more restricted bounding box from the existing data in the 
raster table and the new data you want to add.

And finally you need to adjust the gpkg_contents min_x, min_y, max_x and max_y bounds to 
the new bounding box with something like

ogrinfo existing.gpkg -sql "UPDATE gpkg_contents WHERE table_name = 'foo' SET min_x = ..., 
min_y = ..., max_x = ...., max_y = ...."

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/20180515/a4fe956a/attachment.html>


More information about the gdal-dev mailing list