Hi Bernie,
GdalWarp, or any other Raster manipulation, will indeed will indeed be 
resampling pixels, when you clip the raster it then tries to fit, align your 
pixels into your clipped extents.
Could I suggest that you first generate a GeoTiff from your VRT. You can again 
use GDAL Warp, but the important thing would be to:


1.       Set Georeferenced Extents, using the Calculate from Layer option and 
set it to your 10km grid File.

2.       Additional command-line… just type –tap this will align all pixels in 
the output to the crs/grid.

What the above should do is output a TIFF aligned both in extents and pixels to 
that of your output grid.
I hope that helps, or at least gives you some idea on how you might proceed.

Kind Regards,

Richard






——
Richard McDonnell MSc GIS, FME Certified Professional
Flood Risk Management - Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964 T +353 46 942 2409
https://gov.ie/opw

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/
From: QGIS-User <qgis-user-boun...@lists.osgeo.org> On Behalf Of Bernie Connors 
via QGIS-User
Sent: 01 November 2024 22:39
To: qgis-user@lists.osgeo.org
Subject: [Qgis-user] Cutting Virtual raster into tiles

Hello,

        I have created a virtual raster of DEM data covering approximately 
72,000 km^2.  The DEM has a 1 metre pixel.  The source for the virtual raster 
is about 95 geoTIFF files with irregular shapes.  I have a SHP file with a 10 
km grid of tiles, with a total of 853 polygons (see image below).  I am trying 
to cut the virtual raster into 853 tiles based on the SHP file.  Each tile will 
be 10 km x 10 km.  The tiles in the SHP file are exactly 10,000 metres x 10,000 
metres.  So I expect the DEM tiles to be exactly 10,000 pixels x 10,000 pixels. 
 However, when I run the QGIS Easy Raster Splitter plugin the output geoTIFF 
DEM tiles are 9,999 pixels x 10,000 pixels.  I have checked all 853 tiles and 
they are all 9,999 x 10,000 pixels.  Here are the first few lines reported by 
gdalinfo.

Driver: GTiff/GeoTIFF
Files: nb_2015_16_18_dem_2460000_7480000.tif
Size is 9999, 10000
Coordinate System is:

        Here is an image of the 1 metre gap between the 10 km tiles.  I set the 
scale in QGIS to 1:1,000 for this image.

[cid:image001.png@01DB2EAB.C6BA1210]

        These 1 pixel (1 metre) gaps appear as vertical gaps with a 10 km 
spacing when several tiles are displayed together.

        Both the SHP file and the source DEM GeoTIFFs all use the same 
projected coordinate system - EPSG 2953.  The  Easy Raster Splitter plugin uses 
gdalwarp in the background.  I suspect gdalwarp is doing some kind of 
reprojection when it calculates the intersection between the individual tiles 
in the SHP and the source VRT.  But I am unsure.  Does anybody have a 
suggestion?
[cid:image003.jpg@01DB2EAB.C6BA1210]
Thanks,
Bernie.
--
Bernie Connors, P.Eng
B.Sc Geodesy & Geomatics Engineering
Fredericton, NB
bernie.conn...@unb.ca<mailto:bernie.conn...@unb.ca>
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to