Geographic Information Systems Asked by vvaris on July 25, 2020
I got a river vector file.
I want to rasterize it so that the river is 2 pixels wide.
How do I achieve that in QGIS 3.2.3?
When I try to use vector to raster, I get this and no file is created:
Algorithm 'Rasterize (vector to raster)' starting…
Input parameters:
{ 'BURN' : 0, 'DATA_TYPE' : 5, 'EXTENT' : '413885.10813709395,678750.4296324956,6754403.012272906,6909638.055526119 [EPSG:32635]', 'FIELD' : None, 'HEIGHT' : 0, 'INIT' : 0, 'INPUT' : 'C:UsersvvarisDesktopUomaUoma10.shp', 'INVERT' : False, 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'C:/Users/vvaris/Desktop/asd.tif', 'UNITS' : 0, 'WIDTH' : 0 }
GDAL command:
gdal_rasterize -l Uoma10 -burn 0.0 -ts 0.0 0.0 -a_nodata 0.0 -te 413885.10813709395 6754403.012272906 678750.4296324956 6909638.055526119 -ot Float32 -of GTiff C:UsersvvarisDesktopUomaUoma10.shp C:/Users/vvaris/Desktop/asd.tif
GDAL command output:
ERROR 1: Wrong value for -outsize parameter.
Usage:
gdal_rasterize [-b band]* [-i] [-at]
{[-burn value]* | [-a attribute_name] | [-3d]} [-add]
[-l layername]* [-where expression] [-sql select_statement]
[-dialect dialect] [-of format] [-a_srs srs_def]
[-co "NAME=VALUE"]* [-a_nodata value] [-init value]*
[-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
[-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
CInt16/CInt32/CFloat32/CFloat64}] [-q]
<src_datasource> <dst_filename>
Execution completed in 0.13 seconds
Results:
{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':C:/Users/vvaris/Desktop/asd.tif, 'createOptions': {'fileEncoding': 'System'}}>}
Loading resulting layers
Algorithm 'Rasterize (vector to raster)' finished
You need to know the width of the river.
Once you know that, just use Convert vector to raster
and select a cell size half the width of the river.
Answered by Roberto Zeeland on July 25, 2020
If your vector is a line, you cannot ask for a width of 2 pixels. I suggest you to make a buffer around the line to give it the necessary width, then only rasterize your output. Don't forget to specify the output raster resolution (e.g. -tr 10 10 for 10 m pixel) and don't use the -ts option.
note that converting to float is probably not necessary, but you don't mention the type of values in the field used for the conversion.
Answered by radouxju on July 25, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP