Geographic Information Systems Asked by Aquamarine on April 2, 2021
Is it possible to use the Calculate by Expression tool to output geopackage layers. For example, with the batch option for the polygon to line function. With the following expressions I can create individual shapefiles or individual geopackage files but not layers in a geopackage file;
This creates a separate geopackage file for each layer;@project_folder ||'/' || @INPUT || '_line'
This creates a separate shapefile for each layer;
@project_folder ||'/' || @INPUT || '_line.shp'
However, I can’t find a way to output layers to the one Geopackage file. The Polygon to Line function seems to default to individual geopackage files if no extension is given. The following creates output – not individual layers but separate geopackage files;
@project_folder ||'/test.gpkg layername=' || @INPUT ||'_line
The file names end up like this;
To save the output of a geoprocessing algorithm into a new layer/table of an existing geopackage, you can use the following syntax:
ogr:dbname='C:/Path/To/Geopackage.gpkg' table="New_Table" (geom)
If you want to use this in Calculate By Expression for the outputs of a batch processing, the expression could look like the following:
'ogr:dbname='' || @project_folder || '/Lines.gpkg' table="' || @INPUT || '_line.shp" (geom)'
This will return the output parameters...
... and will create a new geopackage layer for every input:
Answered by malbles on April 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP