Select to view content in your preferred language

Divide polyline by polygon or polyline

3393
9
Jump to solution
06-28-2021 02:43 AM
Vakhtang_Zubiashvili
Frequent Contributor

Hello Guys, @RobertScheitlin__GISP @UndralBatsukh 

I am going to cut (Split) line FL by polygon or polyline, no matter which one. I know there is a geometryEngine  for this, but i could not find any working sample or hint how to use it.

Any help please how to do it.

 

Thank you and stay well and health 

0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Regular Contributor

And here's a very basic sample of it in use. I'm using the line to cut the polygon and just printing the resulting geometries to the console.

https://codepen.io/annefitz/pen/yLbywRr

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Emeritus

@Vakhtang_Zubiashvili 

You can find a sample here that showcases some of the geometryEngines features:

http://ekenes.github.io/esri-js-samples/ge-demo/

and the code can be found here.

https://github.com/ekenes/esri-js-samples/blob/master/ge-demo/index.html

 

Vakhtang_Zubiashvili
Frequent Contributor

Thank you for replay Robert. Will this code work for 4.x API? I am using latest one. What i will need to change?

 

Thank you

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

sorry I do not have a 4.x version link for you.

Vakhtang_Zubiashvili
Frequent Contributor

Not even any small hint how to start, where to go, where to dig? 🤔

0 Kudos
Vakhtang_Zubiashvili
Frequent Contributor

@KenBuja Any idea? 😞

0 Kudos
AnneFitz
Esri Regular Contributor

Here's a more up-to-date version of the documentation that has a code snippet: https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#cut

AnneFitz
Esri Regular Contributor

And here's a very basic sample of it in use. I'm using the line to cut the polygon and just printing the resulting geometries to the console.

https://codepen.io/annefitz/pen/yLbywRr

JohnGrayson
Esri Regular Contributor

Adding to the examples here's one using the sketch widget to interactively draw the polygon and polyline geometries that will be cut:

https://codepen.io/john-grayson/pen/oNWgObw

  1. draw a polygon with any of the polygon tools
  2. draw a polyline with the polyline tool
    1. make sure it splits the polygon
      1. start and finish outside of the polygon
    2. if we find an existing polygon:
      1. cut the polygon with the polyline
        1. if the cut is successful:
          1. the input polygon is removed and the cut results are added
Vakhtang_Zubiashvili
Frequent Contributor

Thank you everyone for help  😍

0 Kudos