2

I want to transform this vector map: enter image description here

To something like this

I only tried to convert the vector map through Raster> Conversion> Rasterize But I get this Error:

QGIS version: 3.6.3-Noosa
QGIS code revision: 0c5774c068
Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.7.2-CAPI-1.11.0 b55d2125
PROJ version: 520
Processing algorithm…
Algorithm 'Rasterize (vector to raster)' starting…
Input parameters:
{ 'BURN' : 0, 'DATA_TYPE' : 5, 'EXTENT' : '-7.370260950471245,-4.1225535257546575,41.90235292713342,44.06838148095345 [EPSG:4326]', 'FIELD' : None, 'HEIGHT' : 0, 'INIT' : None, 'INPUT' : ', : ,.shp|layername=, : ,', 'INVERT' : False, 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'UNITS' : 0, 'WIDTH' : 0 }

GDAL command:
gdal_rasterize -l ", : ," -burn 0.0 -ts 0.0 0.0 -a_nodata 0.0 -te -7.370260950471245 41.90235292713342 -4.1225535257546575 44.06838148095345 -ot Float32 -of GTiff ", : ,.shp" C:/Users/MH/AppData/Local/Temp/processing_ee19710709eb480c9d96feab6da88422/f1d82c27fef04d919819b92cd0c99e49/OUTPUT.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] [-to "NAME=VALUE"]*

[-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}] [-optim {[AUTO]/VECTOR/RASTER}] [-q]

<src_datasource> <dst_filename>

Execution completed in 0.52 seconds
Results:
{'OUTPUT': 'C:/Users/MH/AppData/Local/Temp/processing_ee19710709eb480c9d96feab6da88422/f1d82c27fef04d919819b92cd0c99e49/OUTPUT.tif'}

Loading resulting layers
The following layers were not correctly generated.<ul><li>C:/Users/MH/AppData/Local/Temp/processing_ee19710709eb480c9d96feab6da88422/f1d82c27fef04d919819b92cd0c99e49/OUTPUT.tif</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

Also, rivers are a ShapeFile...

Any thoughts?

Once I'll have the raster file , I would like to do the average of river order (information inside the own vector file) for each pixel square (4kmx4km).

UPDATE

Using this options I get a new Raster file, but its just an empty data black rectangle

QGIS version: 3.6.3-Noosa
QGIS code revision: 0c5774c068
Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.7.2-CAPI-1.11.0 b55d2125
PROJ version: 520
Processing algorithm…
Algorithm 'Rasterize (vector to raster)' starting…
Input parameters:
{ 'BURN' : None, 'DATA_TYPE' : 5, 'EXTENT' : '-7.313948360639435,-3.143202111036134,42.698580776689006,43.655439029853646 [EPSG:4258]', 'FIELD' : None, 'HEIGHT' : 0.0395, 'INIT' : None, 'INPUT' : 'C:/Users/MH/Desktop/QGIS DATA/Ríos/hi_tramocurso_l_Cantocci.shp', 'INVERT' : False, 'NODATA' : None, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'UNITS' : 1, 'WIDTH' : 0.0395 }

GDAL command:
gdal_rasterize -l hi_tramocurso_l_Cantocci -burn 0.0 -tr 0.0395 0.0395 -te -7.313948360639435 42.698580776689006 -3.143202111036134 43.655439029853646 -ot Float32 -of GTiff "C:/Users/MH/Desktop/QGIS DATA/Ríos/hi_tramocurso_l_Cantocci.shp" C:/Users/MH/AppData/Local/Temp/processing_7dc55a08e82b44aaa97ce037141e09ac/aef40f35f85444db9b33af70d8417a71/OUTPUT.tif
GDAL command output:
0...10...20...30...40...50...60...70...80...90...100 - done.

Execution completed in 3.33 seconds
Results:
{'OUTPUT': 'C:/Users/MH/AppData/Local/Temp/processing_7dc55a08e82b44aaa97ce037141e09ac/aef40f35f85444db9b33af70d8417a71/OUTPUT.tif'}`

Loading resulting layers
Algorithm 'Rasterize (vector to raster)' finished

enter image description here

But new file "Rasterize" is full of "0" data, just a black rectangle without attribute table...

By the way, the shape file I rasterize has an attribute table, I think seeing the information within, that is the table who has the information of where does the vector starts and where does the vector ends, with each little river containing a few vectors...

  • 1
    For some reason the WIDTH and HEIGHT are both zeros, so the output image would have no pixels at all. – user30184 Jun 26 at 21:21
  • -ts should contain values other than 0, have a read of gdal.org/programs/gdal_rasterize.html this switch sets the number of rows and columns in the raster.. you're effectively telling GDAL_Rasterize to export 0 pixels wide and 0 pixels high = cell size of 0. – Michael Stimson Jun 26 at 22:50
  • I've changed both values x and y to 0.00352623588456712697 and georeferenced units. However, the new file has no information at all, no one line, Could it be because there are more than one vector per pixel of resolution? – Héctor Jun 27 at 0:25
  • 1
    Did you delete the existing raster or try to overwrite it? GDAL_Rasterize originally needed the raster to exist and that behavior still lingers, if you have an existing raster irrespective of what parameters you use when running the tool the dimensions and cellsize of the existing raster are used. – Michael Stimson Jun 27 at 4:07
  • 1
    , : ,.shp is an invalid filename. Do you really have a file with that name? Try using Windows Explorer to create/rename any file with those characters, and you'll get an error: A filename can't contain any of the following characters: \ / : * ? " < > | – user2856 Jun 27 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.