POST
|
I have this code: tempfile = os.path.join(arcpy.env.scratchFolder, "empty.mxd") mxdfile.saveACopy(tempfile) if I do a len(arcpy.mapping.ListLayoutElements(mxdfile,"LEGEND_ELEMENT")) or len(arcpy.mapping.ListLayoutElements(tempfile,"LEGEND_ELEMENT")) it shows and rightly so that I have a 1 LEGEND ELEMENT after i do: result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, tempfile, extra_conversion_options=AGSSecureServerServices) mxd = result.mapDocument if i do a len(arcpy.mapping.ListLayoutElements(mxd,"LEGEND_ELEMENT")) my LEGEND ELEMENT is gone it shows 0 What could be causing this? The mxd was saved with Desktop 10.6.1 Thanks in advance
... View more
01-31-2020
07:18 AM
|
0
|
1
|
219
|
POST
|
Hi, I'm having an issue with losing a drawing layer datasource: result = arcpy.mp.ConvertWebMapToArcGISProject(Web_Map_as_JSON, templatePagx) aprx = result.ArcGISProject map = aprx.listMaps('Web Map')[0] aprx.saveACopy(r'C:\OUTPUTTESTE\Test.aprx') aprxTemp = arcpy.mp.ArcGISProject(r'C:\OUTPUTTESTE\Test.aprx') map1 = aprxTemp.listMaps('Web Map')[0] map1.listLayers() Basically when I check the layers of the "map" object the layer named "pointLayer" (which consists of a drawn point exported from Web App Builder) has a datasource. After saving a copy of the project and re-opening it, if I check the layer again on the object "map1" everything is equal but the datasource is empty meaning I lost the drawn point. Does anyone know if this is a bug or if there's a workaround for this? Thanks in advance
... View more
05-22-2019
01:47 AM
|
0
|
0
|
203
|
POST
|
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
... View more
05-16-2019
02:31 AM
|
0
|
0
|
239
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|