Subscribe to this thread
Home - General / All posts - Filtering object outer boundaries

1,931 post(s)
#10-May-22 04:03

Is there a way to definitively filter object outer boundary branches from holes? To illustrate what I mean, in the attached M9 project, I have LiDAR extent trace drawing [1 TRACE] which I have split into branches in [2 BRANCH].

I would like to automatically be able to identify which are holes and which are outer branches as I have done manually in [2 BRANCHES].

Any thoughts appreciated as ever.


Landsystems Ltd ... Know your land |


7,014 post(s)
#10-May-22 07:37

Based on a very quick consideration, if you do not have objects within other objects, the first thing that comes to mind is:

1. Use the transform split: branches transform to create a drawing that has separate objects for each branch.

2. With that branches drawing open, use the Join dialog to join it to itself using the geom field with "contained in" as the join condition. Join the mfd_id field into a new field called "count" using the count aggregate method.

3. The branches drawing table now has a count field. Every object that has a count of 1 is just the outer area of what used to be a branch that might have had holes in it. Every object that has a count of 2 or more used to be a hole. Select objects that have a count >= 2 and delete those. Done.

A refinement: the above will split multibranched areas so that an area which consists of a main body and then some islands as branches will end up being separate areas for the main body and the islands. You could use a common attribute field to transform:merge those back together into single multi-branched areas, if desired.


1,931 post(s)
#10-May-22 23:43

Thanks Dimitri, this sounds like a good workflow.

I was idly wondering if there was anything tucked away in the myriad of SQL functions that I had missed or to do with winding direction or some such.

I think your workflow will fit the bill however so many thanks.

Landsystems Ltd ... Know your land |


9,956 post(s)
#12-May-22 14:40

You can try using GeomToShapes.



SELECT [mfd_id]SPLIT CALL GeomToShapes([geom]FROM [1 trace];

...splits each geom into shapes (called 'islands' in 8). The first branch of each shape is an outer contour, all other branches are inner contours.

So, if you run:


VALUE @shapes TABLE = (

  SELECT SPLIT CALL GeomToShapes([geom]FROM [1 trace]


SELECT GeomConvertToLine([value]INTO [outer] FROM (

  SELECT SPLIT CALL GeomToBranches([value]FROM @shapes

WHERE [branch] = 0;

SELECT GeomConvertToLine([value]INTO [inner] FROM (

  SELECT SPLIT CALL GeomToBranches([value]FROM @shapes

WHERE [branch] <> 0; will get outer contours in [outer] and inner contours in [inner].

On your data, the call to GeomToShapes will take a fairly long time, because it has to normalize a huge area.

I note though that you want to classify some of the outer contours as inner. If so, what is the criteria? If an outer contour is contained in some other outer contour, it should be marked as inner? Then it would probably make sense to first fill all holes, then convert each branch to a line and check whether the line is adjacent to the area with all holes filled or intersects it (use either GeomAdjacent or GeomIntersects). The former branches are outer, the latter are inner.


1,931 post(s)
#15-May-22 20:42

This is excellent. Many thanks Adam. I will give it a go this morning.

Landsystems Ltd ... Know your land |


1,931 post(s)
#15-May-22 21:24

I note though that you want to classify some of the outer contours as inner.

No. If I did, this would have been an oversight in the manual selection process I used to prepare the example. What you have provided here is perfect for the task I had in mind so many thanks for the example.

Landsystems Ltd ... Know your land |

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.