[gdal-dev] Append new data to GeoPackege raster table as overview

Even Rouault even.rouault at spatialys.com
Thu Dec 1 03:58:54 PST 2016


On jeudi 1 décembre 2016 11:45:43 CET Rahkonen Jukka (MML) wrote:
> Hi,
> 
> Let's say that I have these raster maps with 2048 m and 1024 m pixel sizes
> http://kartat.kapsi.fi/files/taustakarttasarja_jhs180/taustakartta_8m/2048m/
> etrs89/png/Taustakartta_8milj.png
> http://kartat.kapsi.fi/files/taustakarttasarja_jhs180/taustakartta_8m/2048m
> /etrs89/png/Taustakartta_8milj.pgw
> 
> http://kartat.kapsi.fi/files/taustakarttasarja_jhs180/taustakartta_4m/1024m/
> etrs89/png/Taustakartta_4milj.png
> http://kartat.kapsi.fi/files/taustakarttasarja_jhs180/taustakartta_4m/1024m
> /etrs89/png/Taustakartta_4milj.pgw
> 
> Converting the 8milj.png into GeoPackage raster table is easy
> 
> gdal_translate -of gpkg -a_srs epsg:3067 Taustakartta_8milj.png
> overview.gpkg
> 
> Image goes to zoom level 2 as reported by gdalinfo:
> Metadata:
>   IDENTIFIER=overview
>   ZOOM_LEVEL=2
> 
> But now the hard part: I would like to append the second image 4milj.png to
> the same layer "overview" as ZOOM_LEVEL=3 because that  map is designed for
> that resolution. Is it possible to do that by using some parameters of the
> driver http://www.gdal.org/drv_geopackage_raster.html or with some clever
> trick?

The following works:

gdal_translate Taustakartta_4milj.png test.gpkg -of gpkg  -a_srs epsg:3067 -expand rgba
gdal_translate Taustakartta_8milj.png Taustakartta_8milj_rgba.tif -expand rgba
gdalwarp Taustakartta_8milj_rgba.tif test.gpkg -doo ZOOM_LEVEL=2

Expension to RGBA wouldn't be strictly needed in theory since your 2 rasters have the same palette,
but in practice you have to do it.

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/20161201/77d33b06/attachment.html>


More information about the gdal-dev mailing list