Subscribe to this thread
Home - General / All posts - Split closed lines where they intersect
264 post(s)
#20-Apr-23 16:16

I have a drawing with lines that form closed areas (they come from parcel areas). I want to get joined lines from 3 areas common point to 3 areas common point, like in the image. If I get all joined lines as duplicates, that's another issue that I have a way to tackle. Is there a way to get the lines I want in M9?

I attach the image that shows what I need and a file to test.



10,447 post(s)
#20-May-23 12:47

Sorry for a belated reply.

Yes, of course, this can be done. First you merge the lines (GeomMergeLines), then you split them at the intersections and remove duplicate parts (GeomNormalize), then you output each branch as a separate geom (GeomToBranches).




CREATE TABLE [splitlines_t] (

  [mfd_id] INT64,

  [geom] GEOM,

  INDEX [mfd_id_x] BTREE ([mfd_id]),

  INDEX [geom_x] RTREE ([geom]),

  PROPERTY 'FieldCoordSystem.geom' ComponentCoordSystem([closedlines])


CREATE DRAWING [splitlines] (

  PROPERTY 'Table' '[splitlines_t]',

  PROPERTY 'FieldGeom' 'geom'



INSERT INTO [splitlines_t] ([geom])

SELECT [value] FROM (

  SELECT SPLIT CALL GeomToBranches(GeomNormalize(GeomMergeLines([Geom]), 0))

  FROM [closedlines]


Here's how the result looks like:

I made the existing lines thick gray, kept the split lines thin black and put them on top. Then I At-clicked one of the split lines to show where it starts and ends.


264 post(s)
#20-May-23 15:54

Thank you!

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