Question

Count shared edges of a polygon?

  • 22 October 2021
  • 3 replies
  • 10 views

Badge +14
  • Contributor
  • 120 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

Userlevel 6
Badge +32

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

Userlevel 4
Badge +26

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

Badge +14

@virtualcitymatt​ @nielsgerrits​ 

 

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

 

 

Reply