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 .
I checked the results and found it to be a 32 bit, ii think that's why it cant produce an attribute value.
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?
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.
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
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
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.