Select to view content in your preferred language

How can a MAPX file be created from Python outside of ArcGIS Pro?

1880
3
01-28-2017 08:57 AM
AndyWright
Occasional Contributor

I am trying to script the creation of MAPX files from maps within an APRX.  I need to do this outside of ArcGIS Pro.  I did a lot of reading up in the documentation and I didn't find anything that led me to believe this could be done.  I've been trying to get the Consolidate Map tool to do this.  Seems like it creates a MAPX when you run it within Pro, but it will only run outside Pro when you pass it a MAPX as its first parameter.  As of now it looks like I need to create all my MAPX files manually from within Pro.

So the end game here is to take an existing APRX and script the creation of MAPX files at various extents.  Then I can use those MAPX files as inputs into other Pro-based geoprocessing tools that I can script from Python outside of Pro.  Can anyone point me in the right direction or let me know if this is even possible at this point?  I just upgraded to 1.4 so I have the latest and greatest stuff.  Thanks in advance for the help ...

0 Kudos
3 Replies
DanPatterson_Retired
Deactivated User

Save a map file—ArcGIS Pro | ArcGIS Desktop 

Map package—ArcGIS Pro | ArcGIS Desktop 

Seems to be the desired options, since there is no direct creation function in arcpy.  You can create the mapx, save them and reuse them, but they don't contain the data, if you need the data, then a map package needs to be created.  I looked on ArcGIS Ideas and I only found one link about creating mapx files, so perhaps demand is low or people are using a different workflow

0 Kudos
ECanGIS_Team
New Contributor III

Hi Dan.  Similar issue here.  End goal is to create and upload mobile map package directly to portal using python.  In Pro this is done using the 'Package Mobile Map' tool with the 'Upload package to Online account'.  I don't see any python script that replicates that process.  Closest thing I can see would be to:

1. create local .mmpk using python (Create Mobile Map Package—Data Management toolbox | ArcGIS Desktop )

2. share package from step 1 using python (Share Package—Data Management toolbox | ArcGIS Desktop )

The problem for me is I need a .mapx file to run step 1.  I can't fully automate this process if I have to manually create a .mapx file in Pro.

Reading your response, is it safe to assume this .mapx file only needs to manually created one time then can be reused even if the structure of map within the .aprx has changed?

0 Kudos
DanPatterson_Retired
Deactivated User

2 years... haven't revisited it since, but a quick scan shows no change since then

0 Kudos