I have a vector shapefile of a geographic area that contains several different object codes that I need to rasterize all as one image.
I am working with QGIS, but the Raster>conversion tool seems to be unable to do this (see below). In the tool, it seems as though you cannot select more than one value, not to mention the tool - even when it works - appears to ignore whatever value you have set and rasterizes all values at once, in the same image. That would be ok, but I have a large volume of output to complete, and I don't want to separate every needed raster mask into a separate layer, as this would be extremely inefficient and time consuming
So, I tried running the GDAL command it generates, and even the GDAL command, when entered in the python console, errors out. I have never worked with GDAL before and I am way out of my depth, so I am looking for pointers.
Below is the command I started with (and that QGIS ran successfully when I attempted to rasterize using the form), and no variation of this seems to work in the console, and any edit I perform also returns a syntax error.
gdal_rasterize -l bornholm_final_OSM -a code -ts 100492.0 100492.0 -te 14.510849428030344 54.922004004836744 15.299793055831714 55.37191520877061 -ot Float32 -of GTiff "E:/My Documents/OSM Stuffbornholm_final_OSM.shp" "E:/My Documents/OSM Stuff/point-5m test_qgis2.tif"
I have looked at the GDAL documentation about "gdal_rasterize", but I am truly stumped at this point. I just need the raster to do multiple classes in one image.
Using @BenW'S answer I am now able to create a raster using GDAL, but I now need to ensure that it retains the colors.