0

I have an Esri map with print service enabled. I would like to print a map based on objectid of a feature layer. The following is my Web_Map_as_JSON.

{
    "mapOptions": {
        "showAttribution": true,
        "extent": {
            "xmin": 829017.362240001,
            "ymin": 828550.995070001,
            "xmax": 828609.077310001,
            "ymax": 829053.843320001,
            "spatialReference": {
                "wkid": 102140,
                "latestWkid": 2326
            }
        },
        "spatialReference": {
            "wkid": 102140,
            "latestWkid": 2326
        },
        "scale": 10000
    },
    "operationalLayers": [{
            "id": "LIFIPSBasemap",
            "title": "LIFIPSBasemap",
            "opacity": 1,
            "minScale": 0,
            "maxScale": 0,
            "url": "https://win-enkuf1vq572/arcgis/rest/services/DEV/FSD_LIFIPS_Basemap_v02/MapServer"
        }, {
            "layerType": "ArcGISFeatureLayer",
            "url": "https://win-enkuf1vq572/arcgis/rest/services/DEV/Search/MapServer",
            "visibility": true,
            "opacity": 1,
            "mode": 1,
            "visibleLayers": [0],
            "selectionObjectIds": [2037156],
            "selectionSymbol": {
                "type": "esriSFS",
                "style": "esriSFSSolid",
                "color": [0, 0, 0, 255],
                "outline": {
                    "type": "esriSLS",
                    "style": "esriSLSSolid",
                    "color": [0, 0, 0, 255],
                    "width": 1000
                }
            }
        }
    ],
    "exportOptions": {
        "outputSize": [800, 1100],
        "dpi": 200
    },
    "layoutOptions": {
        "titleText": "ABC, Portrait PDF",
        "scaleBarOptions": {
            "metricUnit": "esriKilometers",
            "metricLabel": "km",
            "nonMetricUnit": "esriMiles",
            "nonMetricLabel": "mi"
        },
        "legendOptions": {
            "operationalLayers": []
        }
    }
}

However, the "selectionObjectIds" and "selectionSymbol" doesn't take effect, i.e. my target shape doesn't fill in black. What's wrong with my JSON?

1

Make sure that your selectionSymbol is appropriate for the geometry type of the feature. The below JSON uses a SimpleMarkerSymbol for the selected feature (point), and the result is visible in the printout.

{  
   "operationalLayers":[  
      {  
         "id":"layer0",
         "title":"World Dark Gray Canvas Base",
         "opacity":1,
         "minScale":0,
         "maxScale":0,
         "url":"https://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer",
         "token":null
      },
      {  
         "id":"Missing Migrants - Incident Reports_880",
         "opacity":0.8,
         "title":"Missing Migrants - Incident Reports",
         "url":"https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/Missing Migrants - Incident Reports/FeatureServer/0",
         "visibility":true,
         "layerType":"ArcGISFeatureLayer",
         "itemId":"3cc2c908c9aa4f2294f2be81e595daf8",
         "selectionObjectIds":[  
            467
         ],
         "selectionSymbol":{  
            "color":[  
               255,
               255,
               0,
               255
            ],
            "size":38,
            "angle":0,
            "xoffset":0,
            "yoffset":0,
            "type":"esriSMS",
            "style":"esriSMSCircle"
         },
         "popupInfo":{  
            "showAttachments":true,
            "popupElements":[  
               {  
                  "type":"text"
               },
               {  
                  "type":"attachments",
                  "displayType":"list"
               }
            ],
            "description":"Description",
            "fieldInfos":[  
               {  
                  "fieldName":"OBJECTID_1",
                  "label":"__OBJECTID",
                  "isEditable":false,
                  "tooltip":"",
                  "visible":false,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":false
               },
               {  
                  "fieldName":"X",
                  "label":"X",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":false,
                  "format":{  
                     "places":2,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"Y",
                  "label":"Y",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":false,
                  "format":{  
                     "places":2,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"OBJECTID",
                  "label":"OBJECTID",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":false,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"CASEID",
                  "label":"CASEID",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"DATEREPORTED",
                  "label":"Date Reported Missing",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "dateFormat":"longMonthDayYear"
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"INFORELIABILITY",
                  "label":"INFORELIABILITY",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"INCIDENTREGION",
                  "label":"INCIDENTREGION",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"DEAD",
                  "label":"Deaths",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"MISSING",
                  "label":"MISSING",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"NATIONALITIES",
                  "label":"NATIONALITIES",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"ORIGINREGION",
                  "label":"ORIGINREGION",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"MIGRATIONROUTE",
                  "label":"MIGRATIONROUTE",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"LOCATIONDESCRIPTION",
                  "label":"LOCATIONDESCRIPTION",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"NOFEMALE",
                  "label":"NOFEMALE",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"NOMALE",
                  "label":"NOMALE",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"NOCHILDREN",
                  "label":"NOCHILDREN",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"AGERANGE",
                  "label":"AGERANGE",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"SOURCE",
                  "label":"SOURCE",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"URL",
                  "label":"URL",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"COMMENT",
                  "label":"COMMENT",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"PUBLICVIEW",
                  "label":"PUBLICVIEW",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"Cause_of_death",
                  "label":"Cause_of_death",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               },
               {  
                  "fieldName":"Number_of_survivors",
                  "label":"Number_of_survivors",
                  "isEditable":true,
                  "tooltip":"",
                  "visible":true,
                  "format":{  
                     "places":0,
                     "digitSeparator":true
                  },
                  "stringFieldOption":"textbox",
                  "isEditableOnLayer":true
               }
            ],
            "title":"{DATEREPORTED}"
         },
         "layerDefinition":{  
            "drawingInfo":{  
               "renderer":{  
                  "authoringInfo":{  
                     "classificationMethod":"esriClassifyManual",
                     "type":"classedSize"
                  },
                  "type":"classBreaks",
                  "classBreakInfos":[  
                     {  
                        "label":"0 to 9",
                        "classMaxValue":9,
                        "symbol":{  
                           "type":"esriSMS",
                           "color":[  
                              168,
                              0,
                              0,
                              255
                           ],
                           "angle":0,
                           "xoffset":0,
                           "yoffset":0,
                           "size":6,
                           "style":"esriSMSCircle",
                           "outline":{  
                              "type":"esriSLS",
                              "color":[  
                                 194,
                                 194,
                                 194,
                                 255
                              ],
                              "width":0.75,
                              "style":"esriSLSSolid"
                           }
                        }
                     },
                     {  
                        "label":"> 9 to 37",
                        "classMaxValue":37,
                        "symbol":{  
                           "type":"esriSMS",
                           "color":[  
                              168,
                              0,
                              0,
                              255
                           ],
                           "angle":0,
                           "xoffset":0,
                           "yoffset":0,
                           "size":16.5,
                           "style":"esriSMSCircle",
                           "outline":{  
                              "type":"esriSLS",
                              "color":[  
                                 194,
                                 194,
                                 194,
                                 255
                              ],
                              "width":0.75,
                              "style":"esriSLSSolid"
                           }
                        }
                     },
                     {  
                        "label":"> 37 to 111",
                        "classMaxValue":111,
                        "symbol":{  
                           "type":"esriSMS",
                           "color":[  
                              168,
                              0,
                              0,
                              255
                           ],
                           "angle":0,
                           "xoffset":0,
                           "yoffset":0,
                           "size":27,
                           "style":"esriSMSCircle",
                           "outline":{  
                              "type":"esriSLS",
                              "color":[  
                                 194,
                                 194,
                                 194,
                                 255
                              ],
                              "width":0.75,
                              "style":"esriSLSSolid"
                           }
                        }
                     },
                     {  
                        "label":"> 111 to 251",
                        "classMaxValue":251,
                        "symbol":{  
                           "type":"esriSMS",
                           "color":[  
                              168,
                              0,
                              0,
                              255
                           ],
                           "angle":0,
                           "xoffset":0,
                           "yoffset":0,
                           "size":37.5,
                           "style":"esriSMSCircle",
                           "outline":{  
                              "type":"esriSLS",
                              "color":[  
                                 194,
                                 194,
                                 194,
                                 255
                              ],
                              "width":0.75,
                              "style":"esriSLSSolid"
                           }
                        }
                     }
                  ],
                  "minValue":0,
                  "field":"DEAD"
               }
            }
         }
      },
      {  
         "id":"World_Dark_Gray_Reference_8618",
         "title":"World Dark Gray Reference",
         "opacity":1,
         "minScale":0,
         "maxScale":0,
         "url":"https://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Reference/MapServer",
         "token":null
      }
   ],
   "mapOptions":{  
      "extent":{  
         "spatialReference":{  
            "latestWkid":3857,
            "wkid":102100
         },
         "xmin":-20869143.210526414,
         "ymin":-8545799.495683521,
         "xmax":20869143.210526414,
         "ymax":12039609.465848394
      },
      "spatialReference":{  
         "latestWkid":3857,
         "wkid":102100
      },
      "showAttribution":true,
      "scale":73957190.948944
   },
   "exportOptions":{  
      "dpi":96
   },
   "layoutOptions":{  
      "titleText":"",
      "authorText":"",
      "copyrightText":"",
      "scaleBarOptions":{  

      },
      "legendOptions":{  
         "operationalLayers":[  
            {  
               "id":"Missing Migrants - Incident Reports_880"
            },
            {  
               "id":"Missing Migrants - Incident Reports_880"
            }
         ]
      }
   }
}
2
  • Thanks Noah! The geometry type of my features is polygon. That's why I prefer using SimpleFillSymbol, is it appropriate? – David Chan Jul 31 '18 at 1:22
  • Yes, that is appropriate. I tested with the SimpleFillSymbol with a polygon, and it worked fine. Also, please note that currently, only the outline of the feature will be selected/highlighted. – Noah Aug 7 '18 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.