Friday 27 November 2015

Creating raster or vector raster from DEM point file?


i have a point shape of 75.000 elevation points in a regular 5 m grid. We now want to create a polygon grid with the elevation points as "centroids".


Unfortunately, all attempts to do so fail: I first thought to create a raster from the point grid, and then vectorize the raster to get my polygon grid. Bu when i create a raster image from the points, the cells are created with the points representing the corners of this cell.



So, how to create a raster image or polygon grid from regular points, where those points represent the centroid ?



Answer



You could use gdal_rasterize either from the command line or QGIS to generate your raster. To make sure your points sit within a cell, you need to do two things. First, set the target resolution to 5m, and set the extents to be 2.5m bigger all around than the source data.


So, assuming your dataset goes from [1000 2000] [2500 3250], giving you your 75,000 points, you'd use something like this:


gdal_rasterize -3d -te 997.5 1997.5 2502.5 3252.5 -tr 5.0 5.0 -ot Float32 -l heights dem.shp dem.tif

This assumes your height data is in a Z point attribute, otherwise just use -a instead of -3d


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...