Is there a way to export the current map state as a JSON object, mostly named Web_Map_as_JSON. The JSON specification should be like this.
In other words, it would be convenient to have a function for the Map object, like myMap.Web_Map_as_JSON() that would provide the current state of the MAP.
Answer
This is not directly available through the API. The PrintTask can be used to get the Web_Map_as_JSON.
map.on("load", function(){
require(["esri/tasks/PrintTask", "dojo/_base/json"], function(PrintTask, JSON){
var printTask = new PrintTask();
var Web_Map_as_JSON = JSON.toJson(printTask._getPrintDefinition(map));
});
});
No comments:
Post a Comment