I have multiple attributes in a vector file which is .shp that I want to convert to a raster, this is because I want to make it the same resolution of another raster file. I will then convert that raster file back to vector once I have burnt all those values I need from the vector-raster conversion. The issue is I need multiple fields and not just one.
-
I'm not sure what sense your workflow makes, probably there is a better way to achieve waht you want, but with such scarce information, it's difficult to say. For using different values to burn in, see my solution below.– BabelCommented Aug 4, 2022 at 12:21
-
1You should consider to create a multiband raster from multiple vector attributes, so every attribute will be one band in your multibandraster: tkawuah.github.io/Blog1.html– eurojamCommented Aug 4, 2022 at 12:37
-
@eurojam Thank you so much for what you sent. This definitely looks like a potential solution to my problem. I do have one issue though. When I do the conversion for instance, of perimeter it returns back as an integer rather then a decimal, is there a way to fix this?– AhmedTechCommented Aug 4, 2022 at 12:43
Add a comment
|
1 Answer
Create a new field (a virtual or a real field) that combines the fields you want to use for burn-in values the way you want using field calculator. Ten use this new field as input.
Like e.g. you have two fields v1
and v2
, calculate a new field v
as the sum of v1+v2
. Then use this new field for rasterization.
-
Thank you for responding. I have added images to explain it better. So I originally have all these attributes. I resample the resolution by converting this into a raster, but it only allowed me to pick one of these fields. I then convert this back to vector so I get the resampled data essentially? Commented Aug 4, 2022 at 12:40
-
The above comment looks like a good way to do this. However another issue I stumble is the fact that when I do this conversions, it goes from decimal to integer and I want it in decimal? @Babel Commented Aug 4, 2022 at 12:46
-
I'm not quite sure what steps you did in detail, so it's difficult to say what happens. The field you create must be of field-type
real (decimal)
, so the numbers will be decimals.– BabelCommented Aug 4, 2022 at 12:57 -
Appreciate the responses @Babel, All I did was use that dataset that I got, and then convert it to a raster file normally, then convert back to vector file. What details are you looking for? The field originally was already decimals, and the conversion from vector to raster seems to automatically just take off the decimals. There is not an option for me to choose real. Commented Aug 4, 2022 at 13:03
-
I'm not sure how you proceeded. When I rasterize, I get decimal values, see the updated screenshot in my solution. So you should provide more details to be able to reproduce the behaviour you encounter.– BabelCommented Aug 4, 2022 at 13:33