I need to implement a functionality which will save all layers added to map,its all display information like current extent, symbology and queried features if any etc. Its similar to saving an mxd(map document) file in arc map. But I want save this layer details in a table in database. When a user will open this saved file the layer should get added to map with all its saved properties.
You can have a similar functionality using the webmap format.
See this sample: Web map using JSON | ArcGIS API for JavaScript
Help format web map json: ArcGIS web map JSON format
Hello Domenico Ciavarella ,
I am still not clear how to store the current json data or layer information of map.I want to save it but not getting how?
As per this sample I got the direction, it is about creating web map from json data.
Gauri Deshmukh, I don't think that there is an out of box for serialize in webmap. You can see sample project how this for serialize : swingley/cereal · GitHub
ciava.at excellent ..using the code for map-cereal.js from swingley/cereal · GitHub, I am able to get JSON response for my current map document and can create Webmap from this json.
Now I am looking for converting this webmap to map or is there any way to construct a map again with the json response.
HI Gauri, this sample illustrates how to get a map from the web map response:
Web map using JSON | ArcGIS API for JavaScript
The key aspect of the sample is using the arcgisUtils class to create a deferred object, then obtain the map from the response.
arcgisUtils.createMap(webmap,"map").then(function(response){
var map = response.map;
//do something with the map here
Hey KDeege-esristaff ,
I dont want to create web map or a map like this, I want to add the layers which i got in response ,separately to the map by map.addddLayer method (as per my requirement).
How do I add layer in the form of object to map.
Can you use the array of layers in the response as a way to accomplish this?
var layers = response.itemInfo.itemData.operationalLayers;