Layer name in Legend in Print.

1996
4
Jump to solution
11-19-2012 06:06 AM
VincenzoPiscitelli
New Contributor
I use the PrintService for ArcGIS 10.1. Using the default pre-installed templates.

On the client I create a feature layer using a feature collection.  Is there a know issue with this layer creation method and printing?

The graphics and basemap print perfectly, but I cannot get the name of the layer that I create via the feature collection to display in the legend of the print template.  I always get "polygonLayer" as the title.

I give both a name and description to the featurelayer:
boundaryLayer2 = new esri.layers.FeatureLayer(featureCollection, {                 id: "thematicGraphics",                 mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,                 name: "Starts By Dwelling Type",                 description: "Starts By Dwelling Type"             });


I also give a name to my layerDefinition:
        var layerDefinition = { name: "Starts By Dwelling Type", geometryType: "esriGeometryPolygon", fields: [{ name: "OBJECTID", type: "esriFieldTypeOID", alias: "OBJECTID" }, { name: uidField, type: "esriFieldTypeString", alias: uidField, length: 255 }, { name: "value", type: "esriFieldTypeDouble", alias: "Starts" }] };
0 Kudos
1 Solution

Accepted Solutions
PeterYurkosky1
Occasional Contributor
I did a bit more hunting, and discovered that this is a known bug. The bug number is NIM085927. We expect to fix it in time for the next release (3.3).

View solution in original post

0 Kudos
4 Replies
PeterYurkosky1
Occasional Contributor
Would you mind sending me the JSON you pass to the server? I'll figure out why the layer name isn't being passed along as you expect.
0 Kudos
VincenzoPiscitelli
New Contributor
Would you mind sending me the JSON you pass to the server? I'll figure out why the layer name isn't being passed along as you expect.


I've been looking at this as well.  You can see that layerDefinition has name = 'polygonLayer'.  I know this is the issue, but nothing I do in the Javascript will change it.

I'm assuming you want to see the Web_Map_as_JSON param.  I have emptied the featureSet [] to keep the post somewhat small.

{
 "mapOptions": {
  "extent": {
   "xmin": -8580100.447969673,
   "ymin": 5542939.755732017,
   "xmax": -8277409.213130328,
   "ymax": 5726388.988967983,
   "spatialReference": {
    "wkid": 54004
   }
  },
  "spatialReference": {
   "wkid": 54004
  }
 },
 "operationalLayers": [{
  "id": "Basemap",
  "url": "http://localhost:6080/arcgis/rest/services/CanadaMercator2010/MapServer",
  "title": "Basemap",
  "opacity": 1
 },
 {
  "id": "thematicGraphics",
  "opacity": 0.75,
  "featureCollection": {
   "layers": [{
    "layerDefinition": {
     "name": "polygonLayer",
     "geometryType": "esriGeometryPolygon",
     "drawingInfo": {
      "renderer": {
       "type": "classBreaks",
       "field": "value",
       "minValue": 0,
       "classBreakInfos": [{
        "classMaxValue": 0,
        "label": "0",
        "description": "",
        "symbol": {
         "color": [222,
         222,
         222,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       },
       {
        "classMaxValue": 1,
        "label": "1",
        "description": "",
        "symbol": {
         "color": [69,
         117,
         181,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       },
       {
        "classMaxValue": 11,
        "label": "1-11",
        "description": "",
        "symbol": {
         "color": [162,
         180,
         189,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       },
       {
        "classMaxValue": 52,
        "label": "11-52",
        "description": "",
        "symbol": {
         "color": [255,
         255,
         191,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       },
       {
        "classMaxValue": 60,
        "label": "52-60",
        "description": "",
        "symbol": {
         "color": [245,
         152,
         105,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       },
       {
        "classMaxValue": 94,
        "label": "60-94",
        "description": "",
        "symbol": {
         "color": [214,
         47,
         39,
         255],
         "outline": {
          "color": [0,
          0,
          0,
          255],
          "width": 0.375,
          "type": "esriSLS",
          "style": "esriSLSSolid"
         },
         "type": "esriSFS",
         "style": "esriSFSSolid"
        }
       }]
      }
     },
     "fields": [{
      "name": "OBJECTID",
      "type": "esriFieldTypeOID",
      "alias": "OBJECTID"
     },
     {
      "name": "neighbourhood_geographic_layer_id",
      "type": "esriFieldTypeString",
      "alias": "neighbourhood_geographic_layer_id",
      "length": 255
     },
     {
      "name": "value",
      "type": "esriFieldTypeDouble",
      "alias": "Starts"
     }]
    },
    "featureSet": {
     "geometryType": "esriGeometryPolygon",
     "features": []
    }
   }]
  }
 }],
 "exportOptions": {
  "outputSize": [null,
  null],
  "dpi": 96
 },
 "layoutOptions": {
  "copyrightText": "2012",
  "scaleBarOptions": {
   "metricUnit": "Meters",
   "metricLabel": "m",
   "nonMetricUnit": "Feet",
   "nonMetricLabel": "ft"
  },
  "legendOptions": {
   "operationalLayers": [{
    "id": "thematicGraphics"
   }]
  }
 }
}
0 Kudos
PeterYurkosky1
Occasional Contributor
I did a bit more hunting, and discovered that this is a known bug. The bug number is NIM085927. We expect to fix it in time for the next release (3.3).
0 Kudos
VincenzoPiscitelli
New Contributor
I did a bit more hunting, and discovered that this is a known bug. The bug number is NIM085927. We expect to fix it in time for the next release (3.3).


Thank you very much.
0 Kudos