So we have factories, bridges, boat launches and stations that are on our map by latitude and longitude data fed to us from Homeland Security. In a good number of these situations an attack can come from the water even though the "point" where the attack can occur is on the land.
I used a process where once we find a point not on the water, we go through this process:
- Convert the waterway raster to polygons
- Save all polygons in an array of polygons
- For the point to be relocated to the water I find the polygon that is nearest, cast that polygon to an IProximityOperator, then call ReturnNearestPoint.
- Finally for debugging purposes we then call CheckCoincidence and we frequently get back a an indicator that the point STILL is not on the water.
Now the stranger part of this is we put the point (that is now Coincident) into a point array and call CostPathAsPolyline which then very nicely throws an exception that tells me diddly poop as to what is wrong with my point. The exception basically states that "all point are at their maximum value in the grid" and naturally ESRI did not document this at all. We assume this happens when either
- The item is still not in the water (thus surrounded by NoData all around it)
- OR the point is in a location that cannot reach the main point
In testing we make certain the latter is not the case by specifically putting points in an area such that all targets are reachable. So if they get moved to the nearest point on the polygon, the CostPathAsPolyline should still work even if the point is on the outer edge of the polygon.
Does anyone have any insight as to why this exception would be thrown when the point is moved onto the waterway???