neilwebster

NumpyArray to Raster

Discussion created by neilwebster on Mar 11, 2013
Latest reply on Mar 13, 2013 by philmorefield
Hi,

I'm trying to convert a Feature Class with attribute fields of X, Y and a Level (effectively Z) to an array and then to a raster for further processing. 

The conversion to an array works using the command:
array = arcpy.da.FeatureClassToNumPyArray(fc,["OID@", "SHAPE@XY", "Level"], spatial_reference=SR)

Where fc is the input Feature Class.

When I then try and covert it to a raster to be able to do spatial analysis functions I get the error "Argument in_array: Expected a two-dimensional Numpy array"

The code I'm using is:
myRaster = arcpy.NumPyArrayToRaster(array)


I can perform array operations like adding up the level using array["Level"].sum() but the array.shape only gives me one number.

Where am I going wrong?

Thanks

Outcomes