Select to view content in your preferred language

Advanced Editing

495
1
09-25-2013 07:46 AM
AndrewPratt
Regular Contributor
I am looking into the possibility of offering staff an online edit tool to replace our current ArcGIS desktop work flow that many staff are having problems learning. The basic editor that is offered in the JS or Flex viewer offers most of what I require but I haven't been able to find a solution to clipping one polygon with another. Essentially I need to be able to draw a bounding box around an area and then draw smaller polygons over top that would be clipped out of the underlying bounding polygon. Think clipping a house out of a yard for example.

Can this be done?
0 Kudos
1 Reply
ZachLiu1
Deactivated User
I don't have the code, but this is what I would try:

first of all, you don't need to use editor to edit features, you can just use featureLayer.applyEdits() method.

1, use a draw tool to draw a polygon withing a polygon in your featureLayer

2, save the geometry of the polygon you just drawn to a variable for update later

3, use featureLayer.selectFeatures() method to select the polygon you want to clip out

4, update the geometry of the polygon. you can use geometry.addRing() method. (may need to arrange the new ring counter-clockwise in order to create a whole)

5, Now the polygon you want to clip out has a new geometry with a whole in it which is the polygon you drawn, you can just use
featureLayer.applyEdits(null, feature, null) to update the clipped out polygon.


check the API references for the corresponding objects and methods.
0 Kudos