Refering to this sample, I can simply draw polygons using the provided api, however they will be stored in a separated feature. I would like to draw multiple polygons and store them in a single feature, like MULTIPOLYGON (((xxxxxx
And then how to save them by applyEdit()? thanks!
Hi Stephen Lam,
It might be possible, if we just keep adding the rings of other geometries to the Rings property of any one geometry. Also need to make sure that the units/spatialreference for the coordinates matches that of the map.
Note: I have not tested this. It is just an idea.
Please let me know if you get it working.
Thanks & Regards,
Vara Prasad.
Thanks for your reply, Vara. I think it should be worked, and I will give it a try if the templatePicker doesn't work for me.
Assuming that you want to store them in an ArcGIS feature service, you might be better of using the Editor widget (than the DrawTool plus your own code). The Editor widget toolbar can be configured to have a "union" (merge) option. The workflow would be to draw multiple features, then select them and click "union".
You can try with this sample: http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=ed_simpletoolbar
and add the "mergeVisible" toolbar options like this:
toolbarOptions: { reshapeVisible: true , mergeVisible: true // add this line to the sample }
Thanks for your reply Bjorn. It works for me!