Select to view content in your preferred language

GetCellValue Returns 'NoData' when I run from script

371
0
04-23-2020 11:18 AM
PatrickHill
Emerging Contributor

Having some issues with the getCellValue tool in arcpy. I am finding that the tool always returns 'NoData' when I run from a script. I can however run the tool with the same inputs in Pro and it gives me an expected value. I have made sure the extents overlap and my rasters and selecting point are in the same projection.

center=arcpy.Describe(boundary).extent.polygon.trueCentroid
coords = '{} {}'.format(center.X, center.Y)
print(coords)
rst_lyr = 'rst_lyr'
arcpy.MakeRasterLayer_management(outdata, rst_lyr, "#", boundary)
result = arcpy.GetCellValue_management(rst_lyr, coords, 1)
print(result.getOutput(0))
cellvalue = float(result.getOutput(0)) #fails here returns no data

return cellvalue‍‍‍‍‍‍‍‍‍‍

Wondering what I am doing wrong here?

-Patrick

Tags (2)
0 Kudos
0 Replies