Draw Widget - How to save drawing

12-13-2017 03:59 AM
New Contributor

Hi Guys

I have added the draw widget to my map.  The drawing functions work fine on the published app, but there is no way to save the drawing.  How do I do this?  I want to be able to send a link to someone of the map, and for them to mark on an area, save that area, and for me to open the map and see that area.


3 Replies
MVP Emeritus


   You should look at the Enhanced Draw custom widget then:

GitHub - magis-nc/esri-webappbuilder-widget-eDraw: Ehanced draw widget for WebApp Builder for Arcgis... 

Demo site:

ArcGIS Web Application 

New Contributor III


I dit not use eDraw, because I don't really like it/don't want this layers structure.
I'ts probably similar, but I did as follows in the standard Draw Widget, in order to save and load a drawing (to/from file):

var graphics = this._getAllGraphics();

var jsonString = "[";
array.forEach(graphics, lang.hitch(this, function(g){
   jsonString = jsonString + "{\"geotype\":\"" + g.geometry.geoType + "\",\"graphic\":" + jsonRef.toJson(g.toJson()) + "},";
jsonString = jsonString.substring(0, jsonString.length - 1) + "]";

var filename = "Drawing.json";
return CSVUtils._download(filename, jsonString);

jsonRef refers to 'dojox/json/ref' and CSVUtils to 'jimu/CSVUtils'

And to import a JSON string/file:

var objects = jsonRef.fromJson(evt.target.result);
for(var i = 0; i < objects.length; i++) {
   var parsedGraphic = new Graphic(objects.graphic);
   var geoType = objects.geotype;

   this._onDrawEnd(parsedGraphic, geoType, null);

evt.target.result comes for a Reader object (onload event)

New Contributor

did this work for you? I am also looking to export or share the drawing (viewer license). Is it possible or only for creator locense?

0 Kudos