Hello everyone. is there a way to convert a polygon shape file into raster if it has values of precise decimal type. I used the polygon to raster tool and the produced raster does not have an attribute table and i cannot use the Build Raster attribute tool to build the table .
There are several ways, but be aware that your resultant table will either be scaled by a factor of 10 or the decimals will be truncated.
For simple truncation, simply convert the floating point raster to an integer raster using the Int tool see the warnings within.
Another way is to scale your raster up prior to truncation ie Int(yourraster + 0.5) that has issues as well
There are other ways that can be suggested like Int(yourraster * 10) but then your whole raster will be scaled up by the factor of 10.
From there you should have an integer raster to continue your process.
I can provide python/numpy solutions as well if you work in that realm
with the Int tool still am not getting the attribute table and when i truncate with 10 all the values become one. I would be glad if you could provide the python/numpy solution
perhaps first you could show what the output raster type was. Specific details from the raster properties would help, but in going forward...
Before you can use build a raster table you need to ensure...
It is not possible to build a raster attribute table for a raster dataset that is a pixel type of 32-bit floating point.
If that apparently isn't an option now, that suggests that your raster has values outside the range permissible for this.
In that event you can look at Copy Raster first to see if it is possible to reduce the bit type prior to creating the table
for instance... some possible candidates with the first being the most probable,
8_BIT_UNSIGNED —An unsigned 8-bit data type. The values supported can be from 0 to 255.
16_BIT_UNSIGNED —A 16-bit unsigned data type. The values can range from 0 to 65,535.
16_BIT_SIGNED —A 16-bit signed data type. The values can range from -32,768 to 32,767.
The python/numpy solution I can address once other efforts via conventional means have failed.
Hi stasha vint ,
Just to be sure I understand what you want. You are converting a polygon featureclass that has an attribute with decimal values, right? In case you want to convert the the polygons to raster and use the decimal values as the raster values, just convert using that attribute. However, a floating raster will never has an value attribute table (VAT). In case you want to have a raster that has the decimal values as attribute in the VAT, you will need to use an integer field (like the ObjectID, in case it doesn't have many values, see How To: Create a VAT ) during rasterization and join the values to the resulting VAT of the raster.
Although you can manage the decimal values as attributes of an integer raster, it is not very useful. To be able to "use" them in a mathematical way in any raster operation, you will need them as raster values.So, can you elaborate why you need these values as attributes of a raster?
I need to use these values to calculate flooded areas that's the reason i need the raster values.
I checked the results and found it to be a 32 bit, ii think that's why it cant produce an attribute value.
Then use the Copy raster tool I suggested to see if you can save with a reduced bit-depth. If may necessitate pruning or rescaling your values to get the data into an appropriate range. Ofcourse it would help if you reported the raster properties or even the values and value ranges from the features you created. Suggestions could be guided more quickly if this information were available.
I am still facing the same problem even after copying the raster, the raster properties and value ranges are as follows:
Ok... now it appears all your values are less than 1.0
Taking the integer just isn't going to cut it.
At this point, go back to your feature class, add an integer field, calculate a value for that field that scales up your floating point values, then convert to a raster...
And secondly... you have unique values... what do they represent???
0.666 = 67
0.342 = 34
0.275 = 28
25.7 = 26
do the above in the field calculator, or just reclass your raster using that classification scheme, remembering that your 'integer' raster is scaled up by a factor of 100