Converting Raster Data Typ

658
11
03-01-2018 07:44 AM
Highlighted
New Contributor II

Good day,

I'm using an external Toolbox in my current analysis. One of the inputs has to be a short integer grid, containing values of "0" and "1". But the field type of the Raster I currently have (Tif-Format) is a long integer. I already tried to add a short integer field in the attribute table and used the field calculation. But the Input raster for the toolbox can not have another column then the short integer value. If I use the tool "delete field" to delete the long integer field, the geographical information gets lost, as this is the main value field. Do you know how I can convert the long into short integer values, od how can I create a new raster with short integer values?

Thanks in advance,

Jonas

Reply
0 Kudos
11 Replies
Highlighted
Esri Esteemed Contributor

If you have Desktop (ArcMap or ArcGIS Pro) and the Spatial Analyst extension you could use the Raster Calculator—Help | ArcGIS Desktop , and calculate something like this :

Con("YourRaster" == 1, 1, 0)

If you point the output to a TIF file, it will create an 8 bit unsigned integer:

You can't change the field type of the value field of a raster, since this is defined by the raster type.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

use CopyRaster

Reply
0 Kudos
Highlighted
New Contributor II

ok, thank you! That means, if I have to have a short integer grid as Input, it can't be a Tiff-raster, but has to be something else?

Reply
0 Kudos
Highlighted
Esri Regular Contributor

No, the new output raster can be any format that supports short int. You decide on the Pixel type.

Reply
0 Kudos
Highlighted
New Contributor II

hm, I don't really understand it ... I open copy raster, Input raster is my 8-bit signed, long-integer tiff-raster. I name the output raster dataset "myraster.tif". I choose 4 bit. It executes and loads the result into the dataset. but when I'm checking the properties of the new raster it's 8-bit unsigned. and if I check the field properties in my attribut table it still says Type: Long

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Are the values in your input raster in the 4 bit range?

Reply
0 Kudos
Highlighted
New Contributor II

I forgot that it was not only my values, but also a "count"-column, thats why... so I trid it again, now its a 4 bit unsigned raster. but still, the field properties in my attribut table is Type: Long... that's what I have to change

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Only way that (I can think of) to do that is to add a short field to the table and then use CalculateField to update the values. To get this newly created field as the primary value field you’ll need to use the Lookup<http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/lookup.htm> tool.

Reply
0 Kudos
Highlighted
New Contributor II

Thank you very much for your help! But sadly that doesn't work, as the lookup tool makes it a long-integer again...

Reply
0 Kudos