Composing the map in JSON

To host a map on your Mobile Content Server, you need to write JSON to define the map. You can write this directly into the Add Item page that is used to upload the map to the Mobile Content Server, or you can write it in a text editor and copy it into the Add Item page.

NoteNote:

This topic assumes you are already familiar with the basic structure of JSON (for details, see Introducing JSON) as well as the map format.

Steps:
  1. Provide the basic structure of a JSON map, including the version parameter.
    {
      "version":"1.1"
    }
    
  2. Add a base map, including an empty array of base map layers and a title.
    {
      "version":"1.1",
      baseMap: {
        "baseMapLayers": [{
        }],
        "title": "World_Topo_Map"
      }
    }
    
  3. Add a base map layer to the array.
    {
      "version":"1.1",
      baseMap: {
        "baseMapLayers": [{
          "opacity": 1,
          "visibility": true,
          "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
        }],
        "title": "World_Topo_Map"
      }
    }
    

    You now have a map that contains a single base map layer.

  4. Add any operational layers.

    Provide the required opacity, visibility, and URL, along with a title. Specifying a mode of 1 indicates the default mode of OnDemand will be used to load features.

    TipTip:

    A mode of 0 corresponds to Snapshot, and a mode of 2 is SelectionOnly.

    {
      "version":"1.1",
      "operationalLayers": [{
        "url": "http://sampleserver5a.arcgisonline.com/ArcGIS/rest/services/Events/FeatureServer/0",
        "visibility": true,
        "opacity": 1,
        "mode": 1,
        "title": "SS5_Events - Events"
      }],
      baseMap: {
        "baseMapLayers": [{
          "opacity": 1,
          "visibility": true,
          "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
        }],
        "title": "World_Topo_Map"
      }
    }
    

    Your map now has both operational and basemap layers.

  5. Upload the map to the Mobile Content Server.
1/23/2012