Hello,
I'm trying to print a map but the legend doesn't get filled.
The JSON is as follows and the layers come from a service that's deployed on AGS on an internal machine:
Web_Map_as_JSON = u'{"mapOptions":{"showAttribution":true,"extent":{"xmin":-1001750.3648022738,"ymin":4665102.550281047,"xmax":-972398.5459408056,"ymax":4671274.840315067,"spatialReference":{"wkid":102100}},"spatialReference":{"wkid":102100},"scale":72223.819286},"operationalLayers":[{"id":"defaultBasemap_0","title":"World_Topo_Map","opacity":1,"minScale":0,"maxScale":0,"url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"},{"id":"PDMPalmela_7277","title":"PDMPalmela","opacity":1,"minScale":0,"maxScale":0,"url":"https://t105vm01.esri-portugal.pt/arcgis/rest/services/PDMPalmela/MapServer","layers":[{"id":2,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":2}}},{"id":3,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":3}}},{"id":4,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":4}}},{"id":5,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":5}}},{"id":6,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":6}}},{"id":7,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":7}}},{"id":8,"layerDefinition":{"source":{"type":"mapLayer","mapLayerId":8}}}]},{"id":"desenhos","opacity":1,"minScale":0,"maxScale":0,"featureCollection":{"layers":[{"layerDefinition":{"name":"pointLayer","geometryType":"esriGeometryPoint"},"featureSet":{"geometryType":"esriGeometryPoint","features":[{"geometry":{"x":-992367.7195802811,"y":4668270.865088885,"spatialReference":{"wkid":102100}},"symbol":{"color":[255,0,0,64],"size":3.75,"angle":0,"xoffset":0,"yoffset":0,"type":"esriSMS","style":"esriSMSCircle","outline":{"color":[255,0,0,255],"width":1.5,"type":"esriSLS","style":"esriSLSSolid"}}}]}}]}}],"exportOptions":{"outputSize":[null,null],"dpi":"300"}}'
I'm running the Python in ArcGis Pro and the layout (pagx) already has some data from AGSOnline and this is what I get
when I export to PDF. The legend doesn't reflect the symbology present on the exported map. It should be :
Now I only achieved this through adding the layer to the map (which doesn't make any sense since it was already on the map):
for lyr in m.listLayers():
if lyr.isWebLayer:
if lyr.supports("LONGNAME") and lyr.supports("NAME"😞
if not lyr.isFeatureLayer:
if not lyr.isBasemapLayer:
m.addLayer(lyr)
That code produces the 2nd PDF but obviously when I save it as an aprx I have duplicated layers. What's weird is inside ArcGis Pro if I drag the layer to the legend it adds it just fine so I reckon it can't be because of faulty data or lack of legend.
.
My question is , can this be a bug? Or am I approaching this the wrong way? Is it because it's a Web Layer?
I appreciate all the help I can get.
Thanks in advance