Timeline for Rasterizing vector shapefiles using multiple burn in values
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 18, 2018 at 6:56 | vote | accept | wyatt8919 | ||
Sep 27, 2018 at 16:35 | comment | added | wyatt8919 | Ben, thank you for explaining this. I think I am beginning to understand. I could create a similar style file that corresponds with the vector qml, and from that achieve the same colors. That said, I am having a lot of trouble burning values. I need to do as many as 180 values (I know, it's a ton), and at the moment, I can't even get one to work. I will continue to experiment. | |
Sep 26, 2018 at 12:23 | history | edited | Ben W | CC BY-SA 4.0 |
added 681 characters in body
|
Sep 26, 2018 at 6:46 | comment | added | Ben W | I also recommend thoroughly reading the QGIS documentation starting with raster style properties here: docs.qgis.org/2.18/en/docs/user_manual/working_with_raster/… (this is for version 2.18- docs for version 3.x are not complete) | |
Sep 26, 2018 at 6:43 | comment | added | Ben W | Well the colours of your vector layer are just a style setting, but If you burnt your raster using values from an attribute field in your vector then you should have those corresponding values burnt into your raster. I assume it's the same field you used to style your original vector layer. When styling your raster, add as many classes as you have values, then double click on the value of each class and enter the value that corresponds to your vector layer. Do the same for the colour (you can get the rgb values from the colour selector dialog in the vector layer symbology). | |
Sep 26, 2018 at 6:01 | comment | added | wyatt8919 | How do I add colors and classes that correspond with the vector layer? What values do I choose? It seems that these won't have any relation to values in the vector layer. | |
Sep 26, 2018 at 5:36 | comment | added | Ben W | I'm not sure about burning colours into separate bands, but do you really need a multi-band raster or do you just want to colour your raster for visualisation? If it's the latter, you can style your raster in QGIS in the layer properties. Select singleband pseudocolor render type, add classes with the green 'plus sign' and assign values, colours and legend labels to each class. You can then save that style and reload it whenever you like. | |
Sep 26, 2018 at 5:26 | comment | added | Ben W | Glad you got it working. The console in QGIS enables interaction with the QGIS API using Python programming language which is very different from GDAL command line syntax. Here are some links to info on the QGIS Python console: qgistutorials.com/en/docs/getting_started_with_pyqgis.html docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/… | |
Sep 26, 2018 at 4:41 | history | edited | Ben W | CC BY-SA 4.0 |
added 6 characters in body
|
Sep 26, 2018 at 4:32 | comment | added | wyatt8919 | Ben - thanks for your clarification. You were indeed right, running in command line works (why, then, does QGIS have a console??). Anyway...I now need to generate a raster that retains color. I have read that this is possible, but I am still struggling with the syntax. I found this link that explains it is possible, but I am struggling with the dev's explanation. How do I burn each into a separate band? EDIT: I updated the post to show where I am now. | |
Sep 26, 2018 at 4:29 | comment | added | Ben W | The QGIS processing toolbox implementation of the GDAL utility should also work fine for you if you adjust your parameter settings in the GUI. I have edited my answer with a bit more info. | |
Sep 26, 2018 at 4:28 | history | edited | Ben W | CC BY-SA 4.0 |
added 1095 characters in body
|
Sep 26, 2018 at 4:07 | comment | added | Ben W | Hi Wyatt, GDAL is a library of command line utilities, so the command as you have typed it above should be run from the OSGEO4W shell (I am assuming you are on Windows here) not from inside QGIS. The quickest way to launch it is to type "osgeo4w" into the search function. At the command prompt you first need to change directory to the location of your shapefile. To do this type cd followed by a space then the full path to your file. Hit enter then type your command e.g. gdal_rasterize etc and hit enter again to run the command. | |
Sep 26, 2018 at 3:07 | comment | added | wyatt8919 |
Hi Ben, thanks for your response. First of all, I am trying to run this in QGIS and seems to not accept any command I give it. I feel like I am following the syntax exactly off the documentation, but it just won't do it. I specified the algorithm, specified the attribute name, added the where clause, given it extents, specified the layer, and the output. What else do I need to do? gdal_rasterize -a code -where 'code="7502"' -ts 4096.0 4096.0 -te 14.510849428030344 54.922004004836744 15.299793055831714 55.37191520877061 -l bornholm_final_OSM.shp testqgis2.tif
|
|
Sep 25, 2018 at 7:11 | history | answered | Ben W | CC BY-SA 4.0 |