vrt2GeoPackage Rasters

My previous post didn't mention how to setup the Ordnance Survey layers (or any other raster and vector combination) in a single GeoPackage from virtual rasters, so I thought i would elaborate on the 'gdal_translate' part. It's quite easy...you can simply cut and paste this command in Linux or Windows. Remember to substitute with your own paths with your virtual raster layers.

The advantages of the GeoPackage format in QGIS3 are not only speed of map scrolling and zooming but the ability to store (in a database table) your map 'styles' and zoom levels (for vector layers) within when needing to work offline or with Qfield. Also remember that you do not need to include the .vrt extension.

Before you start install and open QGIS 3.0 and then open the 'Browser' and select 'GeoPackage' then right click 'Create database'.



You will then see the panel below. Enter a database name for your new GeoPackage and leave everything else as 'default', then press 'OK'. You should now see a new empty GeoPackage at the location you specified.




Now open the Terminal/Commandline and type the following one layer/block at a time depending on the number of .vrt layers you have.

:~$ gdal_translate /your/path/to/vrtfile/OS_GB_Overview_19-09-17/OS_GB_Overview_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=OS_GB_Overview_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO

:~$ gdal_translate /your/path/to/vrtfile/OS_MiniScale_19-09-17/OS_MiniScale_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=OS_MiniScale_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO

:~$ gdal_translate /your/path/to/vrtfile/250k_19-09-17/250k_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=250k_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO

:~$ gdal_translate /your/path/to/vrtfile/50k_19-09-17/50k_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=50k_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO

:~$ gdal_translate /your/path/to/vrtfile/25k_19-09-17/25k_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=25k_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO

:~$ gdal_translate /your/path/to/vrtfile/VML_19-09-17/VML_19-09-17 /your/path/to/gpkg/psma.gpkg -of GPKG -co APPEND_SUBDATASET=YES -co RASTER_TABLE=VML_19-09-17 -co ZOOM_LEVEL_STRATEGY=AUTO


Comments

Popular posts from this blog

Qgis-server...Installing the QGIS Lizmap Plugin & Lizmap Web Client

Install QGIS 3.22 LTS with QGIS-SERVER-3.22 and Apache2 on Ubuntu 22.04 LTS

Qgis-server...Installation on Ubuntu 16.04 LTS