[GIS] Can ArcGIS Export Web Map task print labels from a Feature Layer

arcgis-serverjsonprinting

I'm creating json to create a custom printout using the Export Web Map task on an ArcGIS server (v10.2).

Everything works as expected apart from labels are not showing in the generated printout. The layer is a feature layer and the shapes in the layer appear fine but the labels don't.

The labels do appear in our web map application so it looks like there's no problem with the labels themselves. The values and styles are all as expected.

I've tried to find another feature layer on the web and use it to see if the issue is with our MXD but the labels don't appear in the output from the "export web map" either.

To demonstrate, I've used the Hurricance layer from this ArcGIS web map application:

I've used this json to demonstrate that the layer is rendered but the labels are missing in the printout:

{
  "mapOptions": {
    "showAttribution": true,
    "extent": {
      "xmin": 9407172,
      "ymin": 2006620,
      "xmax": 11117172,
      "ymax": 3596620,
      "spatialReference": {
        "wkid": 3857,
        "latestWkid": 3857
      }
    },
    "spatialReference": {
      "wkid": 3857,
      "latestWkid": 3857
    },
    "scale": 4000000
  },
  "operationalLayers": [
    {
      "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
      "title": "Base Map",
      "opacity": 1
    },
    {
      "url": "https://tmservices1.esri.com/arcgis/rest/services/LiveFeeds/Hurricane_Active/MapServer/0",
      "title": "Active Hurricanes",
      "opacity": 1
    }
    ,
    {
      "opacity": 1
    }
  ],
  "baseMap": [
      ],
  "exportOptions": {
    "dpi": 96
  }
}

(It may be necessary to update the extent to locate an active hurricane)

My question is why do the labels not appear when printing?

In the ExportWebMap specification there isn't the option to define labelingInfo for Feature Layers so is this something that's just not supported or is it a bug with the task?

The other thing I noticed is that there is no labeling info defined for the layer when you look at the DrawingInfo in the Hurricane sample layer but that does not seem to make a difference as I can define styles in the MXD and when published I can see the labels appear in the web map with the correct style. – Just printing fails to show them.

Best Answer

The problem here is that Active Huricanes layer is added as a feature layer rather than a dynamic map service. Difference is that dynamic map service serves rendered images and rendering is done on server so everything is rendered as specified in MXD.

However, the feature layer serves the actual geometry (vertices) and symbology used. Rendering is then done client side. In general symbology can be applied (it might be simplified in some cases) but labels are not supported.

So the correct JSON to print out given two layers with labels is below. Note the change in the url for 'Active Huricanes' layer and additional property 'visibleLayers':

{
  "mapOptions": {
    "showAttribution": true,
    "extent": {
      "xmin": 9407172,
      "ymin": 2006620,
      "xmax": 11117172,
      "ymax": 3596620,
      "spatialReference": {
        "wkid": 3857,
        "latestWkid": 3857
      }
    },
    "spatialReference": {
      "wkid": 3857,
      "latestWkid": 3857
    },
    "scale": 4000000
  },
  "operationalLayers": [
    {
      "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
      "title": "Base Map",
      "opacity": 1
    },
    {
      "url": "https://tmservices1.esri.com/arcgis/rest/services/LiveFeeds/Hurricane_Active/MapServer",
      "title": "Active Hurricanes",
      "opacity": 1,
      "visibleLayers": [0]
    }
    ,
    {
      "opacity": 1
    }
  ],
  "baseMap": [
      ],
  "exportOptions": {
    "dpi": 96
  }
}
Related Question