|
POST
|
2 immediate errors I see are: 1) MapDocument was spelled incorrectly 2) You are not specifying an output MXD name with .saveACopy Also - when using backslashes in a string it is best to place an "r" (for raw) in front of the string to avoid possible escape characters. I made all corrections below
import arcpy, os
path = r"Z:\maps"
for root, dirs, files in os.walk(path):
for fileName in files:
basename, extension = os.path.splitext(fileName)
if extension == ".mxd":
fullPath = os.path.join(root, fileName)
mxd = arcpy.mapping.MapDocument(fullPath)
mxd.findAndReplaceWorkspacePaths(r"Z:\maps\xxx.mdb", r"Z:\maps\cultural\xxx.mdb")
newPath=os.path.join(r"Z:\maps\cultural\repaired_links", fileName)
mxd.saveACopy(newPath)
print mxd.dateSaved
Jeff
... View more
08-23-2012
07:14 AM
|
0
|
0
|
733
|
|
POST
|
You can not "setup" DDP using arcpy. A map document must be authored and saved with DDP enabled (and set up). Once a map document is DDP enabled, then arcpy.mapping can be used to automate whichever pages you need. Jeff
... View more
08-20-2012
09:23 AM
|
0
|
0
|
948
|
|
POST
|
This group is where you can find sample arcpy.mapping and map automation downloads. http://www.arcgis.com/home/group.html?owner=MapAutomationTeam&title=arcpy.mapping%20%2F%20Map%20Automation You may need to adjust the �??Show:�?� setting in the top of your navigation menu from �??Web Content Only�?� to �??All Content�?� in order to see all the samples. Jeff
... View more
08-14-2012
03:22 PM
|
0
|
7
|
6407
|
|
POST
|
Here is a new sample recently made available on the arcpy.mapping group located in ArcGIS Online. http://www.arcgis.com/home/item.html?id=3a525b986b774a3f9cbbd8daf2435852 It shows how to use the new 10.1 cloning to build truely dynamic tables. Jeff
... View more
08-13-2012
08:25 AM
|
0
|
0
|
937
|
|
POST
|
NIM083567 should address this issue at 10.1 SP1. ReplaceDataSource should NOT rename table layer names in the TOC (it doesn't do this for standard layers). It should simply replace the data source and it is up to you is you want the name to be changed. table.name = "something" is all you would need to do after the fix is in place. Thanks again for reporting this, Jeff
... View more
08-09-2012
07:00 AM
|
0
|
0
|
1171
|
|
POST
|
This was confirmed as a bug (NIM083567) and will be addressed for 10.1 SP1. Thanks again, Jeff
... View more
08-08-2012
07:21 AM
|
0
|
0
|
1171
|
|
POST
|
I can reproduce the issue. Name should be r/w just like for layers. You said it works on some machines? If a bug, we'll address in a SP. Thanks! Jeff
... View more
08-07-2012
09:26 AM
|
0
|
0
|
1171
|
|
POST
|
Have you tried something like: >>> mxd = arcpy.mapping.MapDocument("Current") ddp = mxd.dataDrivenPages df = arcpy.mapping.ListDataFrames(mxd)[0] for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum arcpy.mapping.ExportToTIFF(mxd,r"C:\Temp\\" + str(ddp.pageRow.Name) + ".tif", df) Where the "Name" pageRow.Name is the name of the field in the index layer. Jeff
... View more
08-06-2012
12:06 PM
|
0
|
0
|
1607
|
|
POST
|
I can not reproduce this. Could you please provide more information about the update layer and source layer as well as the script that includes the UpdateLayer function. Thanks, Jeff
... View more
08-06-2012
11:50 AM
|
0
|
0
|
699
|
|
POST
|
I just tried testing this and I could not reproduce (both with the UI and arcpy). The exported DDP multi-page PDF appears to be using the settings. I added an RGB composit SID file and used the same settings as you. When I next each page in ArcMap and compare to the resulting output PDF, things look the same. What version/sp are you using? Arc you exporting from the UI or arcpy? Thanks, Jeff
... View more
08-06-2012
10:46 AM
|
0
|
0
|
1558
|
|
POST
|
This was fixed and will be made available with 10.1 SP1. Jeff
... View more
08-02-2012
07:27 AM
|
0
|
0
|
2637
|
|
POST
|
ArcGIS Engine and Server provide the arcpy site package (which includes arcpy.mapping). You would also need a Desktop to author an MXD that could then be used from the arcpy.mapping linux environement. Jeff
... View more
07-30-2012
09:40 AM
|
0
|
0
|
716
|
|
POST
|
A slight correction to the last email. It is correct in that arcpy.mapping can't create new MXDs but with arcpy.mapping you can add layers using the "AddLayer", "AddLayerToGroup", or InsertLayer" functions. This would require having pre-authored layer files or a reference to a layer from another MXD. Jeff
... View more
07-20-2012
12:45 PM
|
0
|
0
|
1401
|
|
POST
|
I'm the guilty one, that was my presentation and my quote. Now I want to give it some context and ask a couple of questions. Authoring symbology in ArcMap is a simple process but think of all the possibilities and all the options available via the symbology properties dialog. We could easily triple the arcpy.mapping API but just attempting to provide all that capability. We don't want to do that. We are trying to keep arcpy.mapping as simple as possible without making it as complex as ArcObjects. Do you just want to change the color ( should we include RGB, CMYK options), or will you also want to change the symbol size, outline width, pattern, etc, etc? That was the point of attempting to draw the line in the sand between what is pure map automation and what can be done with ArcObjects. Help me understand, in a real mapping scenario, why do you need to dynamically change these symbol properties? Why does the color/size of a layer need to change going from map sheet to map sheet? If the point is to update the color for a layer in many map documents across a system, then UpdateLayer along with a layer file works really well (without having to recreate ArcObjects capabilities at the arcpy.mapping level). I'm not trying to argue here, I'm looking for well documented scenarios to help us continue expanding the capabilities of arcpy.mapping where absolutely needed for map automation tasks. At 10.1, we added quite a few new capabilities including some symbology classes that are needed to support map automation: GraduatedColorSymbology, GraduatedSymbolsSymbology, etc. Thanks for your help, Jeff
... View more
07-19-2012
11:24 AM
|
2
|
6
|
4983
|
|
POST
|
Another option to consider is to simply run a query on your index layer (e.g, SelectLayerByAttribute) and export using the selected index features.
ddp.exportToPDF(outpdf, page_range_type="SELECTED")
Jeff
... View more
07-19-2012
08:51 AM
|
0
|
0
|
2362
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-05-2025 11:20 AM | |
| 3 | 06-05-2025 09:21 AM | |
| 1 | 05-14-2025 01:19 PM | |
| 2 | 04-24-2025 07:54 AM | |
| 1 | 03-15-2025 07:19 PM |
| Online Status |
Offline
|
| Date Last Visited |
06-23-2026
10:29 AM
|