how to generate 'web_map_as_json' string from a web map in python

336
2
04-02-2020 08:02 PM
artzaifman
New Contributor III

Looking for explanation of how to generate "web_map_as_json" string as the argument to mapping.export_map()

0 Kudos
2 Replies
DanPatterson_Retired
MVP Esteemed Contributor

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

Understand web map JSON

would help

artzaifman
New Contributor III

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)

0 Kudos