Looking for explanation of how to generate "web_map_as_json" string as the argument to mapping.export_map()
I have recently had to solve this problem. @artzaifman's answer was a good help, but it wasn't clear on how to find the webmap item in a Portal environment. Here is an updated version:
# find webmap in portalwebmap_item_id = "YOUR_WEBMAP_ITEM_ID_HERE"gis = GIS(url=YOUR_PORTAL_URL_HERE, token=YOUR_TOKEN_HERE)webmap = gis.content.get(webmap_item_id)webmap_as_json = webmap.get_data()
# convert webmap to aprxwebmap_as_json['mapOptions'] = {'extent':webmap_data['initialState']['viewpoint']['targetGeometry']}webmap_as_json['exportOptions'] = json.loads('{ "dpi" : 300, "outputSize" : [1000,1000]}')result = arcpy.mp.ConvertWebMapToArcGISProject(webmap_as_json)aprx = result.ArcGISProject
This seemed to do the trick:
wm_as_json = json.loads(str(wm.definition))wm_as_json['mapOptions'] = json.loads('''{ "extent" : { "xmin":-88.55, "ymin":17.55, "xmax":-72.75, "ymax":38.05, "spatialReference" : { "wkid" : 4326 } }}''')wm_as_json['exportOptions'] = json.loads('''{ "dpi" : 300, "outputSize" : [1000,1000]}''')
mapping.export_map(webmap_as_json=wm_as_json)
This link
arcgis.mapping module — arcgis 1.8.0 documentation
refers yo to the documentation in arcgis help topics
Web map printing with arcpy.mp—ArcPy | Documentation
which has some stuff to read, and maybe the section on
would help
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.