Skip to main content

I have a scenario like this:

Blocks_startwhere I have a series of points, each surrounded by lines. Each line is split at every intersection and we can assume that all possible polygons would be closed. The lines, unfortunately, contain no useful attribute information to assist in this selection process

 

What I'm looking for is a good method to reliably select line features that can form a polygon, that surrounds the point, with the shortest perimeter.

 

For example in the diagram below the orange point would have the orange lines selected and the same for the purple.

Blocks_selection

Hi @tomf If the lines are already noded then you just need an AreaBuilder and a PointOnAreaOverlayer to copy the attributes from the points to the polygons.


Thanks @danatsafe​ fro your reply, however, in this situation an AreaBuilder does not work (already using it earlier). Generally what would happen then is that the lines would form the black polygons (including the ones adjacent to the coloured ones in my example) and leave the remaining polygons unclosed, as the closing lines have already been used. What I'm trying to do is select the closest/shortest closed loop of lines around the points that have not successfully had a polygon built from the earlier AreaBuilder.


@tomf What do you get with an Intersector and/or a Snapper? The TopologyBuilder will intersect too and also show you any dangling nodes/lines.


@danatsafe​ This is actually the output from a TopologyBuilder! Source is a CAD file where not all intended polygons are drawn as polygons, some are drawn as a series of lines where some lines are missing (as they are the same as adjoining polygons). Where polygons are in the source we can use them, but to fix the source errors I need to construct the badly input polygons from the lines in the source for the polygon (in the original example, these would be the external lines) plus any other lines already used by the other polygons to complete the "bad" polygon.

It almost feels to me like I need to take the "good" lines and 'walk' though the rest of the topology to select the remaining lines. In some extreme cases a "bad" polygon may only have one straight line originally assigned.


@danatsafe​ This is actually the output from a TopologyBuilder! Source is a CAD file where not all intended polygons are drawn as polygons, some are drawn as a series of lines where some lines are missing (as they are the same as adjoining polygons). Where polygons are in the source we can use them, but to fix the source errors I need to construct the badly input polygons from the lines in the source for the polygon (in the original example, these would be the external lines) plus any other lines already used by the other polygons to complete the "bad" polygon.

It almost feels to me like I need to take the "good" lines and 'walk' though the rest of the topology to select the remaining lines. In some extreme cases a "bad" polygon may only have one straight line originally assigned.

@tomf You might need a GeometryCoercer to get the "good" polygons back into lines, maybe a LineExtender and/or a Snapper and then an Intersector?


They are already lines (edges from TopologyBuilder)


They are already lines (edges from TopologyBuilder)

Can you attach a sample dataset here?


Can you attach a sample dataset here?

Hi @danatsafe​ — just getting data from client now, things might not be as bad as I have indicated. Will let you know. Thanks for your help so far!


@danatsafe​ - so now I've got my hands on the client's data/workspace I've resolved this.

Essentially it boiled down to:

  1. For all lines and polygons, coerce to lines (GeometryCoercer)
  2. Split features by geometry into segments (PathSplitter)
  3. Build topology (TopologyBuilder)
  4. Build all polygons where possible (AreaBuilder: End Point Snapping and 0.00001m tolerance)

After that I have the complete set of closed polygons and other linework ready for the rest of the workflow — PointOnAreaOverlayer etc.

Thanks for your help!


Reply