|
POST
|
DF.zoomToSelected() works fine at 10.1. There must be something specific to your code. The same applies to .refresh(). It would be much more helpful if you provided a snippet of your code along with the error messages. Jeff
... View more
12-18-2012
06:12 AM
|
0
|
0
|
1729
|
|
POST
|
A common scenario is that the locator map shows the entire entent and as you go from page to page in DDP, the extent of the main dataframe is displayed in the locator map. It is important that you get the directionality of the extent indicator correct. If you accidentally show the extent of the locator map in the main dataframe you will not see anything because the locator extent is well outside the extent of the main data frame. Be sure to build the extent indicator on the locator data frame. Jeff
... View more
12-18-2012
06:07 AM
|
0
|
0
|
5198
|
|
POST
|
If you are using Python all you simply need to do is reference the text element using arcpy.mapping.ListLayoutElements and then reset its .text property to overwrite the dynamic tags. I'm curious about the problem of dynamic text disappearing during PDF export. What issue and what help topic addresses it? Jeff
... View more
12-17-2012
06:47 AM
|
0
|
0
|
1008
|
|
POST
|
I just copy/pasted your second code snippet, made minor path and query changes, and ran it just fine in 10.1 sp1. Here is the code I used.
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Untitled.mxd")
ddp = mxd.dataDrivenPages
indexLayer = ddp.indexLayer
arcpy.SelectLayerByAttribute_management(indexLayer, "NEW_SELECTION", "\"State_Name\" = 'Rhode Island'")
#arcpy.SelectLayerByAttribute_management(indexLayer, "NEW_SELECTION", '"SHAPE_AREA" > 0')
for indexPage in ddp.selectedPages:
ddp.currentPageID = indexPage
ddp.exportToPDF(r"C:\Temp\\" + str(indexPage) + ".pdf", "CURRENT")
del mxd
Comment out your SelectLayerByAttribute line and run the code. Nothing should get exported unless you have saved features in your MXD. Jeff
... View more
12-14-2012
05:41 AM
|
0
|
0
|
1065
|
|
POST
|
PDFDocumentCreate is really intended for appending existing PDFs into it in order to generate multi-page documents. ExportToPDF can be found on the DataDrivenPages object as suggested above but it also is available as a root arcpy.mapping function (if you are not using DDP). http://resources.arcgis.com/en/help/main/10.1/#/ExportToPDF/00s300000027000000/ The {resolution} parameter allows you set set the DPI. Jeff
... View more
12-14-2012
05:23 AM
|
0
|
0
|
1224
|
|
POST
|
You could use string concatenation. a = "2013AWS_HOps_Map_UTM16_" b = "200" c = "_00.pdf" fileName = "{0}{1}{2}".format(a,b,c) print fileName Jeff
... View more
12-13-2012
05:20 AM
|
0
|
0
|
1074
|
|
POST
|
Please add this to the Esri ideas web site. Then promote it. http://ideas.arcgis.com/ Jeff
... View more
12-12-2012
11:43 AM
|
0
|
0
|
970
|
|
POST
|
You'll need to open an incident with support services. They'll be able to help isolate the issue and identify what is causing the problem. Jeff
... View more
12-12-2012
11:41 AM
|
0
|
0
|
1070
|
|
POST
|
Not that I'm aware. Arcpy.mapping has a function called ExportToPDF that can generate geo PDFs. http://resources.arcgis.com/en/help/main/10.1/#/ExportToPDF/00s300000027000000/ Jeff
... View more
12-12-2012
11:39 AM
|
0
|
0
|
1101
|
|
POST
|
Fun question! The solution really depends on the general shape of your index features. It also depends on the way that you want to number the features. I'm assuming starting NW then across and downward to SE. If your features are rectangular then you could perhaps use GridIndexFeatures to generate a grid with page numbers, convert that to a point FC and overlay/calc fields into your original FC. But if your features are not uniform, it gets more interesting. Here is what I did. Convert index FC into a raster based on OID. Make sure your cell size is appropriate so there is a grid value for every OID (otherwise you'll need to test for that). I convert to raster because when you process a raster you work with the upper left cell, move across, then down, etc. Next I convert the raster into a numpy array (a list of a list of cell values in each row of the raster). I build a unique list of OID values from the array. They are built in the direction mentioned above and only the first occurance is added to the unique list. I place each of those values into a dictionary along with a corresponding page number for every OID value. Then I simply iterate through each feature in the original index FC, gets its OID, then set a new field called "page number" based on the page number for that OID. Here is the code: import arcpy myArray = arcpy.RasterToNumPyArray(r"C:\Temp\test_fGDB.gdb\testraster") mxd = arcpy.mapping.MapDocument("current") pageNumber = 1 myUniqueList = [] myDictionary = {} for eachArray in myArray: for value in eachArray: if value not in myUniqueList: myUniqueList.append(value) myDictionary[value] = pageNumber pageNumber = pageNumber + 1 lyr = arcpy.mapping.ListLayers(mxd)[0] cur = arcpy.UpdateCursor(lyr) for row in cur: value = row.getValue("OBJECTID") row.setValue("PageNumber", myDictionary[value]) cur.updateRow(row) del cur I hope the explaination is clearer than mud. Jeff
... View more
12-12-2012
11:13 AM
|
0
|
0
|
1089
|
|
POST
|
Here are a couple of other things I see: First, your lyr variable is not a layer, it is currently a python list. Change: lyr = arcpy.mapping.ListLayers(mxd, "Routes2010_NHigh_Alldata", df1) to lyr = arcpy.mapping.ListLayers(mxd, "Routes2010_NHigh_Alldata", df1)[0] To get better performance, don't call ListLayoutElements so many times. Just call it once.
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if elm.name == "RTNUM": RtNumElem = elm
if elm.name == "COUNTY": CoElem = elm
if elm.name == "LOCATION": LocElem = elm
...
Jeff
... View more
12-11-2012
05:37 AM
|
0
|
0
|
1142
|
|
POST
|
If you only export the pages that have changes and typing in ranges or numbers manually works then where is it failing on you? Does it fail all the time or only on specific pages? Have you tested moving the excel data into a GDB table - does it fail then? Jeff
... View more
12-11-2012
05:19 AM
|
0
|
0
|
1070
|
|
POST
|
I just tested this. The above post is close. You need to include the table name. print ddp.pageRow.getValue("STATES.STATE_NAME") Jeff
... View more
12-10-2012
09:40 AM
|
1
|
0
|
1220
|
|
POST
|
I did something similar. I built an electrical distribution application that allowed someone to enter in a Feeder ID, it would then query the 100's of 1000's of features that match that ID, then use GridIndexFeature to dynamically build a DDP index grid for those features only, and then export the extents/pages out to a multi-page PDF. Similar to your scenario, I could not do it all with one MXD. For some reason if I dynamically switch out the DDP index layer data source in the map I run the script against, weird, unexplainable things happened. So I did it with 2 mxds. The first MXD had basic layers that I queried and used to build the dynamic DDP index layer. The second MXD is already DDP enabled and when I call .refresh it works well. The partial code below shows how I used the two MXDs:
import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])
arcpy.env.overwriteOutput = True
####Stript tool parameters
feederID = arcpy.GetParameterAsText(0)
##Part 1 - Create subset to build features
mxd = arcpy.mapping.MapDocument(relpath + r"\\FeederMap1.mxd")
##Reference appropriate layers and set definition queries
POCLyr = arcpy.mapping.ListLayers(mxd, "Primary Overhead Conductor")[0]
POCLyr.definitionQuery = "\"FEEDERID\" = '" + feederID + "'"
# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(relpath + r"/Scratch.gdb/DDPgrid", [POCLyr], "INTERSECTFEATURE", "", "", "10000 feet", "6500 feet")
del mxd, POCLyr, PUCLyr, stationLyr
##Part 2 - Prepare Feeder Map and Export to PDF
mxd2 = arcpy.mapping.MapDocument(relpath + r"\\FeederMap2.mxd")
#Reference appropriate layers and set definition queries
for lyr in arcpy.mapping.ListLayers(mxd2):
if lyr.name == "Primary Overhead Conductor":
lyr.definitionQuery = "\"FEEDERID\" = '" + feederID + "'"
POCLyr = lyr
ddp = mxd2.dataDrivenPages
ddp.refresh()
ddp.exportToPDF(relpath + r"\Feeder_" + feederID + ".pdf")
del mxd2 I hope this helps, Jeff
... View more
12-07-2012
05:28 AM
|
1
|
0
|
1808
|
|
POST
|
This is not a bug. This type of command only works when added to the appropriate context menu. If you drag this command onto a toolbar, there is no layer context. I.e., how would the command know for what layer you want to build the feature selection for? If you tried dragging this command onto the feature layer context menu (where it already resides) it would work. Sorry, Jeff
... View more
11-29-2012
08:24 AM
|
0
|
0
|
2156
|
| 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
|