2

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:

  1. Convert the waterway raster to polygons
  2. Save all polygons in an array of polygons
  3. 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.
  4. 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

  1. The item is still not in the water (thus surrounded by NoData all around it)
  2. 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???

0

After spending a week going nuts we went through several iterations trying to find a solution to getting nearest point. We don't know or understand if NearestPoint creates edge issues or if the polygon is just rougher than the actual raster. We tried several steps to actually affect the nearest point:

  • Fibonacci Sequence generating a golden spiral to locate the waterway

This only partially worked (northern hemisphere) but found out way too late it was because I worked only with positive angles instead of positive/negative relative to the x axis. Also our second run resulted in worse results on both hemispheres.

  • Next step was to get the angle between the origin and the relocated tango. Then move in a fixed amount to hopefully put it on the water.

Well hopeful was more like wishful thinking. Especially since I have no GIS training and no understanding of the measurement that a single 1.0 on the x,y axis measures. (1 pixel or 1 cell size or 1 mm or what?) But I did return a few points moved to the water.

  • I decided to 'go for broke' and after getting the angle I walked along that radial until the point was coincident with the waterway.

I was real happy to see I did not put my code into an infinite loop. I got all but one point returned with being on the water. The last point was on the water but returned an empty geometry which I still have to research. (not sure why it was empty but it was coming back empty from ESRI so it isn't my code I hope)

So I think this process basically proved that IProximityOperator.ReturnNearestPoint does not really return a point that is on the raster. But it can be used to find the best angle of approach to move that tango towards the origin for processing that does not throw an ESRI exception. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.