Skip to main content
Question

Replacing a line in an existing polygon


melanied
Contributor
Forum|alt.badge.img

Hello,

 

I have two shapefiles :

  • an existing polygon shapefile
  • a newer file containing a line (more precise) that covers part of the existing polygon file

My goal is to obtain a polygon in which the more recent line is replaced in the initial polygon. I have identified the indexes of the points that need to be deleted in the initial file but I don't know how to add between these two indexes the points of the more recent line.

I thought of making a loop in a customTransformer but it seems quite complex...

 

Do you have any suggestions ?

3 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • August 18, 2020

A couple of different options.

 

Use the Snipper to remove the boundary between identified indexes. Use an AreaBuilder to rebuild the polygon with the remaining boundary and newer line.

 

Use the PolygonCutter custom transformer.

 

Use the AnchoredSnapper in SegmentSnappingMode with the line as the anchor. You may need to densify the polygon first.

 

Use a pythonCaller to manipulate the polygon boundary curve.


Forum|alt.badge.img+2
  • August 18, 2020

@melanied Do you have a small example dataset you could share with the community?


melanied
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • August 20, 2020
jdh wrote:

A couple of different options.

 

Use the Snipper to remove the boundary between identified indexes. Use an AreaBuilder to rebuild the polygon with the remaining boundary and newer line.

 

Use the PolygonCutter custom transformer.

 

Use the AnchoredSnapper in SegmentSnappingMode with the line as the anchor. You may need to densify the polygon first.

 

Use a pythonCaller to manipulate the polygon boundary curve.

Thank you for your answer : Snipper and AreaBuilder seem a good solution. I succeed in replacing a line in a polygon with these transformers. The reality is that for each polygon I have generally more than one line to replace, I have to iterate and it's not easy to update the initial indexes. If you have any suggestion for this part, I am listening !


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings