4

I am developing an ArcMap extension and I need to validate a particular case. I need to detect adjacents polygons that have one value equal, and the others not equal. I you take a look at the image, the yellow polygons are invalid and I need to inform the user. The sector is "Sector 2" on both polygons but, the next value is not the same (100 vs 200). If the sectors were different, the polygons would be valid. The violet and green polygons are okay, because for the violet one, the values are all the same and for the green one, the polygons are not touching.

The reason why I am doing this is because the user must use only one polygon for a same sector if the polygons are touching. So if all the values are the same, I can dissolve the polygons otherwise the dissolve won't work.

Is there a way to do this?

Adjacent validation

  • What sort of extension are you developing - ArcObjects or a Python AddIn? – PolyGeo Sep 8 '16 at 14:40
  • ArcObjects, it can be multiple operations, I don't need it to be done with one tool. – Math Sep 8 '16 at 14:52
5

This can be done with arcobjects.

Create a generic dictionary, Dictionary<int,List<string>> and load it using a cursor, looping through features from your polygon featureclass, such that the key is the ObjectID and a List of field values (e.g. "Sector 2", "100").

Find the ITopologyExtension, and get the IMapTopology.Cache.

Loop through each ITopologyGraph.Edges and check the dictionary to see if left and right parents have appropriate values.

If it's a violation, create an ILineElement with the edge's geometry, and add it to the Map using IGraphicsContainer.

  • Have to say that is a pretty nifty way of doing it! Simple question is IMapTopology an object that is limited by license level in anyway? Is it something that only Advanced licensed machines can use or can a Basic license level make use of this object? – Hornbydd Sep 8 '16 at 16:02
  • 2
    IMapTopology is what the Topology Toolbar uses behind the scenes. Since it works with Basic (ArcView) license, I suppose arcobjects code that uses it would also work. Creating Database topologies, OTOH, require Standard+ licensing. I've never tested code with just a Basic license though. esri.com/news/arcuser/0703/files/av_topo_tut.pdf – Kirk Kuykendall Sep 8 '16 at 16:06
  • 1
    This sort of thing sure was simpler with workstation ARC/INFO. – Kirk Kuykendall Sep 8 '16 at 16:26
  • I never used these interfaces before but, from what I see in Arcobjects help, calling the Edges.next method until it returns nothing will give me the adjacents features? So, if I have no adjacent features, Edges.next will always return nothing isn't? – Math Sep 8 '16 at 17:45
  • If you populate your MapTopology with a featureclass that has at least one polygon feature, it should have at least one edge in the enumerator. – Kirk Kuykendall Sep 8 '16 at 18:30

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.