Skip to main content
Question

Count shared edges of a polygon?

  • October 22, 2021
  • 3 replies
  • 113 views

aron
Enthusiast
Forum|alt.badge.img+16
  • Enthusiast
  • 136 replies

I want to single out polygons that share only one edge with other polygons. In the example below the polygon circled in red has one shared edge whilst the blue polygons have two neighbouring edges.

 

I have tried everything I could think of using TopologyBuilder but have not found a way to separate "reds" from "blues". I can't find a useful patern amongst lists and attributes.

 

Any suggestions on how to count how many of a polygons edges are shared with other polygons?

 

House

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • October 22, 2021

You can do this with a LineOnLineOverlayer, see attached workspace.


virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • October 22, 2021

This worked for me:

The process assumed no overlapping polygons, only polygons with hared or no boundaries. It also assumes that an edge is a single line segment (two vertices).

 

  1. Create unique ID for each polygon
  2. Extract polygon geometry to later get back
  3. Use Chopper to split polygon into line segments (max verts = 2)
  4. LineOnLineOverlayer (Separate colinear segments = yes) and make sure to set overlap count attribute
  5. ExpresisonEvaluator - subtract 1 from overlap count attribute (this should result in '0' for edges not touching anything and a '1' for shared edges)
  6. Aggregate, group by the original polygon id - set attributes to sum to be the overlap count Attribute. You should now have one feature with the number of shared boundaries
  7. Use GeoemtryReplacor to restore original geometry

 

image


aron
Enthusiast
Forum|alt.badge.img+16
  • Author
  • Enthusiast
  • 136 replies
  • October 25, 2021

@virtualcitymatt​ @nielsgerrits​ 

 

Thanks to both of you! Subtracting the overlay by 1 gave me the tools to move on.