steinj14

Is there any way to define popups for a map service?

Discussion created by steinj14 on Jun 20, 2013
Latest reply on Jun 20, 2013 by steinj14
I have downloaded the Basic Viewer template. I am creating my webmap with code.

I want to add an entire map service as an operational layer so the labels will display. But I also need the popup functionality.

Is there a way to define the popups within the map service?

The only way I've figured out is to add both the map service (for feature display and labels) and also add all the individual layers contained in the map service (for popup functionality).

Here's the code I've used:
        webmap.itemData = {
          "operationalLayers": [
           //Community-Based Planning Area (display map service to show features and labels)                    
           { "url": "http://gis.tpcmaps.org/ArcGIS/rest/services/Websites/tpcCPA/MapServer",
             "visibility": false,
             "opacity": 0.6,
             "title": "Community-Based Planning Areas",
             "id": "cpa",
             "description": null
           },
           //Adopted County CPA (display individual layer for popup functionality)                                          
           { "url": "http://gis.tpcmaps.org/ArcGIS/rest/services/Websites/tpcCPA/MapServer/2",
             "visibility": true,
             "opacity": 0,
             "mode": 2, //Selection-only          
             "title": "popup Adopted - County Community-Based Planning Area",
             "id": "popctyadoptedcpa",           
             "popupInfo": {
          "title": "Adopted - County<br />Community-Based Planning Area",
          "fieldInfos": [
            {
              "fieldName": "CPA",
              "label": "Adopted CPA",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            },
            {
              "fieldName": "Link",
              "label": " ",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            }          
          ],
             "description": null
             }
           },
           //Proposed County CPA (popup)
           { "url": "http://gis.tpcmaps.org/ArcGIS/rest/services/Websites/tpcCPA/MapServer/1",
             "visibility": true,
             "opacity": 0,
             "mode": 2, //Selection-only           
             "title": "popup Proposed - County Community-Based Planning Area",
             "id": "popctyproposedcpa",           
             "popupInfo": {
          "title": "Proposed - County<br />Community-Based Planning Area",
          "fieldInfos": [
            {
              "fieldName": "CPA",
              "label": "Proposed CPA",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            },
            {
              "fieldName": "Link",
              "label": " ",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            }          
          ],
             "description": null
             }
           },
           //Proposed Tampa CPA (popup)
           { "url": "http://gis.tpcmaps.org/ArcGIS/rest/services/Websites/tpcCPA/MapServer/0",
             "visibility": true,
             "opacity": 0,
             "mode": 2, //Selection-only           
             "title": "popup Proposed - Tampa Community-Based Planning Area",
             "id": "poptaproposedcpa",           
             "popupInfo": {
          "title": "Proposed - Tampa<br />Community-Based Planning Area",
          "fieldInfos": [
            {
              "fieldName": "Name",
              "label": "Proposed CPA",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            },
            {
              "fieldName": "Link",
              "label": " ",
              "isEditable": false,
              "tooltip": "",
              "visible": true,
              "stringFieldOption": "textbox"
            }          
          ],
             "description": null
             }
           },


This seems redundant, and I would guess would negatively impact performance since I'm loading the same layers twice?

Is there a better way or have I landed on the best option?

Outcomes