Wednesday, 12 February 2020

Using GDAL tool rasterize with QGIS so that points represent center of grid


I want to convert point data into a grid and used the gdal tool rasterize. The tool works but unfortunately the result looks like this.



enter image description here


The converted point does not represent the center of the grid but the topleft corner. I need it to be in the center. I couldn't find any settings in the tool nor Explanation in the GDAL-Documentation to accomplish that.


Does anyone have suggestions?


I rasterrized the points into raster and NOT raster to point.


If I upload the data directly as raster I get them correct but that doesn't always work. In the picture the underlying raster image is the correct one.


enter image description here



Answer



Just modify the extent to so that xmin = xmin - 1/2 pixel, xmax = xmax + 1/2 pixel, ymin = min - 1/2 pixel, ymax = ymax + 1/2 pixel.


i.e assuming your desired pixel size is 1m and your point layer extent is xmin, xmax, ymin, ymax = 32346264.0,32346299.0,5631990.0,5631999.0


Then set your extent to 32346263.5,32346299.5,5631989.5,5631999.5



enter image description here


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...