I'm using the following command to cut a GeoPackage from a GeoTIFF file:
gdalwarp -of GTiff -cutline input_database.gpkg -crop_to_cutline input_raster.tif output_raster.tif
Additionally, I know I can use -csql
for making queries inside my GeoPackage database:
gdalwarp -of GTiff -cutline input_database.gpkg -csql "select geom from database" -crop_to_cutline input_raster.tif output_raster.tif
However, if I try to use any spatial function inside this query (like the st_buffer()
function):
gdalwarp -of GTiff -cutline input_database.gpkg -csql "select st_buffer(geom,5) from database" -crop_to_cutline input_raster.tif output_raster.tif
I receive the error ERROR 1: Failed to identify source layer from datasource
. While opening the GeoPackage with Spatialite, I can make this query work with this solution. One of them is adding the function GeomFromGPB()
on my geometries, but I've tested the last command with it and it didn't work as well. What am I missing? How can I use spatial functions on GeoPackages while using gdalwarp
to cut the new geometry from a GeoTIFF file?
ogrinfo
andogr2ogr
. When I try to use it withgdalwarp
I get the errorERROR 6: Unknown option name '-dialect'
.