Select to view content in your preferred language

NumPyArrayToRaster with string array

718
1
04-03-2012 01:57 AM
RA1
by
New Contributor
I am trying to use the NumPyArrayToRaster for a string array

I am using two input arrays: arcpy.RasterToNumPyArray(raster1) and arcpy.RasterToNumPyArray(raster2)
with dtype('uint8')

My output array is created from a loop that sums both input arrays in str format, something like: str(array1)+"+"+str(array2) with dtype='|S4'


When I try to export it to raster format I get the following error:
raceback (most recent call last):
  File "<pyshell#103>", line 1, in <module>
    arcpy.NumPyArrayToRaster(outputarray)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 1165, in NumPyArrayToRaster
    return _NumPyArrayToRaster(*args, **kwargs)
ValueError: Argument in_array: Array type is not supported.


Is there any limitation of type of arrays we can export to raster format ??
Tags (2)
0 Kudos
1 Reply
PhilMorefield
Frequent Contributor
You're probably better off working the arrays as array objects instead of strings, especially if you're eventually going to convert them to a raster. I've never seen a raster with text for values.
0 Kudos