AnsweredAssumed Answered

SimpleLineSymbol converted to CartographicLineSymbol in ExportWebMap/updateLayerFromJSON, causing rough edges of polygon outlines

Question asked by vknezevic on Jun 22, 2017

Hi,

 

I encountered an issue while building a custom high-resolution print geoprocessing service, which causes my polygon outlines to have rough edges in the printout. This can be reproduced even in the pure Export Web Map task, by executing it on a web map that contains client-side polygon feature layer with a SimpleRenderer.

 

 

Issue

In summary, I narrowed the problem down to both ConvertWebMapToMapDocument and updateLayerFromJSON. What happens is that those functions produce a CartographicLineSymbol, instead of SimpleLineSymbol that was given to them in JSON as a polygon outline. The CartographicLineSymbol they create has Line Caps set to Butt and Line Joins to Miter, which make polygon outlines look rough in the high-resolution map printout.

 

Steps to reproduce

Environment

I used ArcGIS Server 10.5 for testing Export Web Map task and ArcMap 10.5 for testing the effects of updateLayerFromJSON to a layer in map document.

Attached files

  • updatelayerfromjson-bug-repro.zip: Contains a map document used in updateLayerFromJSON repro steps along with its small file gdb

1. ConvertWebMapToMapDocument issue

1.1 A webmap contains a client-side polygon feature layer represented via SimpleRenderer with white fill and black outline. It is passed to a GP task (following Export Web Map specification) that uses ConvertWebMapToMapDocument.

"drawingInfo": {
  "renderer": {
    "type": "simple",
    "symbol": {
      "color": [
        255,
        255,
        255,
        255
      ],
      "outline": {
        "color": [
          0,
          0,
          0,
          255
        ],
        "width": 0.75,
        "type": "esriSLS",
        "style": "esriSLSSolid"
      },
      "type": "esriSFS",
      "style": "esriSFSSolid"
    }
  }
}

1.2. After ConvertWebMapToMapDocument is called, the webmap gets converted to a map document, but there are spikes in polygon outlines, as shown here:

1.3. ArcMap Symbol Editor shows that the symbol actually used is Cartographic Line Symbol, instead of Simple Line Symbol:

1.4. After changing the Cartographic Line Symbol to Simple Line symbol in the dialog manually:

1.5. The geometry now looks as it should, in contrast to the initial look from point 2, shown also here on the right::

 

2. updateLayerFromJSON issue

2.1. Open the attached MXD. It contains a layer named "Outline" with only one feature. Its outline is symbolized using Simple Line Symbol (white fill, black outline) and the geometry looks like this:

2.2. Run the following Python script to check what current symbology would look like in JSON:

mxd = arcpy.mapping.MapDocument("CURRENT")
layer = arcpy.mapping.ListLayers(mxd, None, mxd.activeDataFrame)[0]
layer._arc_object.getsymbology()

2.3. The resulting JSON is (as expected):

{
  "renderer": {
    "type": "simple",
    "symbol": {
      "type": "esriSFS",
      "style": "esriSFSSolid",
      "color": [
        255,
        255,
        255,
        255
      ],
      "outline": {
        "type": "esriSLS",
        "style": "esriSLSSolid",
        "color": [
          0,
          0,
          0,
          255
        ],
        "width": 0.38
      }
    }
  },
  "transparency": 0
}

2.4. Now, let's apply the same renderer from the previous step (but this time with a red outline) to the layer, by running the following Python script:

drawing_info_json = u'{"drawingInfo":{"renderer":{"type":"simple","symbol":{"color":[255,255,255,255],"outline":{"color":[255,0,0,255],"width":0.38,"type":"esriSLS","style":"esriSLSSolid"},"type":"esriSFS","style":"esriSFSSolid"}}}}'
layer.updateLayerFromJSON(drawing_info_json)
arcpy.RefreshActiveView()

2.5. Now, the color is changed, but the Cartographic Line Symbol is used instead of Simple Line Symbol present in the JSON and the spikes are again present:

2.6. Symbol Editor confirms that Cartographic Line Symbol is used instead of Simple Line Symbol:

Workarounds?

I was not able to find a way to avoid this issue, and because of this our "high-resolution" print service does not make much sense.

 

If anyone thinks of a possible workaround for this, I would be grateful to know.

 

Thanks,

Vladimir

Outcomes