I am writing a python script for a geoprocessing tool in arcmap. I have a polygon in WGS 1984 Web Mercator (Auxiliary Sphere) and a raster grid, raster1, in WGS 1984. I reproject the polygon to create a mesh of points that are contained within the boundary of the polygon and laid out in a uniform grid. Now, the goal is to check raster1 at each point in the mesh and detrimine if the corrosponding cell has a value at that xy. If it does remove the point from the mesh. If it doesn't, keep the point. In the end I want to have a fragment of the mesh of points which contains all points for which the raster had no value.
My first attempt was to loop through the points and use arcpy.GetCellValue_management() to see what the value was at each point. But the GetCellValue_management fuction seems to take a painfully slow 2-3 seconds (I have a lot of points). Anyone know why this takes so long? An identify on the same raster in arcmap is almost instant!
So now I'm thinking about using Clip_management to clip out the intersection of the polygon and the raster and then RasterToPolygon to get a polygon representing that intersection. Then finally using Erase_analysis to erase from the point mesh those points in the intersection.
What do you guys think? Is plan two good? Whats the fastest way of doing this?