AnsweredAssumed Answered

Quickest way to establish if a point is already a vertex in multipart geometry

Question asked by paul.haakma on Apr 20, 2018
Latest reply on Apr 24, 2018 by NManocha-esristaff

Hi all.

 

Let's say I have a point, and I also have a multipart geometry which could be a polygon, polyline or just a multipoint.

 

What would be the quickest way, using Runtime v100.x, to establish if that point is already a vertex in that geometry?

 

Obviously I could cycle through each part in the geometry and then through each point (or just every point for the multipoint) and test if any match using the Geometry.Engine, but that seems a long winded way to do it and surely not the most efficient.

 

Another way would be to cycle through the parts, add the points of each to a multipoint builder, then check for an intersection of the point with the multipoint, but that seems just as long winded as before. I couldn't see any built in method of a Polygon or Polyline to convert it to a Multipoint (although there IS a method on a Polygon to return it as a Polyline). I would suggest that such a method (convert to Multipoint) would be a good enhancement for the future, either as a method on the actual geometry, or even via the Geometry.Engine.

 

With a small polygon/polyline with only a few vertices it hardly matters, but for complex geometries with thousands of vertices the approaches above could get a little slow. In this case, I suspect the second approach above might be slightly faster, as it only does one Geometry.Engine comparison.

 

Any other suggestions?

Outcomes