1

I am a beginner in ArcGIS and Python.

I have MXD document created in ArcGIS 10.5. I had created data driven page (DDP) using index shapefile consisted of 35 polygons. I had set name field in DDP from that shapefile with attribute information such as percil-1, percil-2,...percil-35.

I want to save new MXD with the name using the field name attribute but in previous version arcgis 10.0 or 10.1 not in 10.5 MXD version, and I want the final result something like this: percil-1.mxd, percil-2.mxd, percil-3.mxd....percil-35.mxd.

Can I do that in Python?

closed as off-topic by PolyGeo Mar 12 '18 at 22:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Have you tried simply using File|Save A Copy? If so, what happened? – PolyGeo Mar 12 '18 at 11:36
  • Are you asking how to create one 10.0 mxd for each data driven page? – BERA Mar 12 '18 at 11:41
  • I have tried using save as copy, but my driven page document contain 35 grid indexs in one thematic map. I have 7 thematic map to export. Now, I am using ArcGIS 10.5 but I am asked to save separate MXD in arcgis version 10.0 – edikazuo Mar 12 '18 at 11:49
  • While possible, saving to an ancient format may result in data loss if the newer source was not supported. 10.0 has been in Retired status for 26+ months. At some point, conversion might result in an empty document. – Vince Mar 12 '18 at 12:27
  • It sounds like you need to edit more details into your question to describe more precisely where you are stuck. – PolyGeo Mar 12 '18 at 12:30
3

Use Mapping - MapDocumnet - saveACopy:

This performs the same operation as File > SaveACopy in ArcMap

See first code sample (http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/mapdocument-class.htm):

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for df in arcpy.mapping.ListDataFrames(mxd):
    mxd.activeView = df.name
    mxd.title = df.name
    mxd.saveACopy(r"C:\Project\Output\\" + df.name + ".mxd")
del mxd

Add version to this line:

mxd.saveACopy(r"C:\Project\Output\\" + df.name + ".mxd", '10.0')
  • Thanks for replying, BERA. I will try your sugestion. But before that Can this script export all page (35 pages) in my driven page MXD? – edikazuo Mar 12 '18 at 11:53
  • 1
    That is what I asked you above. I dont understand your answer. The code will create on copy of one mxd. Data driven pages has nothing to do with making a copy of a MXD unless what you are asking is how to create one MXD for each data driven page?' – BERA Mar 12 '18 at 11:54
  • Yes, I want to create 10.0 seperate page MXD (35 pages in result) from one 10.5 driven page MXD using python script. – edikazuo Mar 12 '18 at 12:01
  • 1
    Copy one 10.5 MXD to one 10.0 MXD? The code will do this. The data driven pages is saved within the MXD. – BERA Mar 12 '18 at 12:06
  • 1
    Have a look at community.esri.com/thread/43201, that will give you the code to save each data driven page out to a separate MXD. import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\GreatLakes.mxd") ddp = mxd.dataDrivenPages for pageNum in range(1, ddp.pageCount + 1): ddp.currentPageID = pageNum print "Saving %s.mxd" %(ddp.pageRow.getValue(ddp.pageNameField.name)) mxd.saveACopy(r"C:\Temp\\" + ddp.pageRow.getValue(ddp.pageNameField.name) + ".mxd", "10.0") del mxd – Dan Mar 12 '18 at 23:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.