How can I Split A polygon and how can I merge serveral polygon

5656
8
Jump to solution
08-12-2014 02:18 AM
xiaoyunnsongb
New Contributor III

Dear superiors:

    Now I have a question to request ,please lost several minutes.

Q1: How can i split a polygon

   now   there is a polygon A,when i draw a line, then the polygon split to two (A1,A2).

A.jpg

                                      pic one

B.png

                                                             pic two

Q2:How can i merge serveral polygon to one

   now  there is two  or more than two polygons next (A1,A2) ,when I  press Ctrl key ,then  the polygons all be choiced ,how  can I merge then to one(A)

like the picture up  pic two ------> pic one

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JoshHevenor
Occasional Contributor II

You'll need the geometryService:

geometryservice-amd | API Reference | ArcGIS API for JavaScript

This will get you geometries and you can update/create your features for saving as required. Here's how I've done this.

Split:

- Start with a selected polygon (know what you're splitting)

- Use the draw toolbar to get a line (onDrawEnd Event)

- I use the GeometryService->trimExtend to make sure the line will cut completely

- Use geometryService->cut([selectedPoly], newLine, ...) to get two new polys

- save the new polys (add two new and delete old, or whatever works for your data)

Merge

- Select multiple polygons

- geometryService->union([selectedPolys]) to get one poly

- save the new poly (delete the old, add new, etc).

I haven't touched on managing the attributes, but that shouldn't be bad once you have the geometries:

View solution in original post

8 Replies
BartSmit
New Contributor II

there should be a 'merge' option in the menu on your editor toolbar. Make sure you have only features selected from the same layer otherwise the merge will not work.

xiaoyunnsongb
New Contributor III

Dear Mr Bart Smit:

         Thanks very much.

  Is it   esri/dijit/editing/Editor? Yes in a  layer, How can i split the polygon?

                Best wishes

0 Kudos
BartSmit
New Contributor II

hhm, I'm afraid I spoke too soon. I can't find any code that has merge/split. All I can find is vertex/move/snap etc .. It might have been a geoprocessing service that offered that functionality. Or it might not have been esri stuff.. I can't recall the example. I'm sorry.

0 Kudos
xiaoyunnsongb
New Contributor III

Dear Bart Smit:

Also thanks to you。

0 Kudos
xiaoyunnsongb
New Contributor III

Superiors:

           My  function is  in javascript Of html ,not desktop, thanks very much。

0 Kudos
MonyrothLy
New Contributor III

U can use the cut polygon tool

xiaoyunnsongb
New Contributor III

Dear monyrothly

       Thanks very much. But  I still  not  understand, Can you give the  component  in esri, 

Wish  you happy every day.

0 Kudos
JoshHevenor
Occasional Contributor II

You'll need the geometryService:

geometryservice-amd | API Reference | ArcGIS API for JavaScript

This will get you geometries and you can update/create your features for saving as required. Here's how I've done this.

Split:

- Start with a selected polygon (know what you're splitting)

- Use the draw toolbar to get a line (onDrawEnd Event)

- I use the GeometryService->trimExtend to make sure the line will cut completely

- Use geometryService->cut([selectedPoly], newLine, ...) to get two new polys

- save the new polys (add two new and delete old, or whatever works for your data)

Merge

- Select multiple polygons

- geometryService->union([selectedPolys]) to get one poly

- save the new poly (delete the old, add new, etc).

I haven't touched on managing the attributes, but that shouldn't be bad once you have the geometries: