Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

NumpyArray to Raster

$
0
0
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:
Code:

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:
Code:

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

Viewing all articles
Browse latest Browse all 2485

Trending Articles