|
POST
|
Let me explain this a little more clearly. In your scenario, you have 2 data frames on a single layout but with different extents. No matter how you address this, you need the equivalent of two index layers; one to drive the first extent, the second to drive the other extent. Your options: 1) Use DDP to drive the first extent and arcpy.mapping to drive the second extent or 2) Use arcpy.mapping to drive both extents. Below is some sample code that sets the 1st data frame's extent based on each feature extent in the first layer:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd)[0]
rows = arcpy.SearchCursor(lyr.dataSource):
for row in rows:
newDFExt = row.getValue("Shape").extent
df.extent = newDFExtent
arcpy.mapping.ExportToPDF(mxd, somepath)
del mxd
The logic could be easily extended to multiple data frames. I hope this helps, Jeff
... View more
12-16-2011
05:42 AM
|
0
|
2
|
4805
|
|
POST
|
This can't be done with Python at 10.0. At 10.1 we've added two new r/w properties to the Layer class: maxScale and minScale. You should be able to accomplish what you need with these. Jeff
... View more
12-16-2011
05:23 AM
|
0
|
0
|
1110
|
|
POST
|
It wasn't working because the first parameter in your original ExportToPDF and ExportToJPG functions were using an MXD path, not an MXD reference. Jeff
... View more
12-16-2011
05:21 AM
|
0
|
0
|
2220
|
|
POST
|
What error message are you getting? Try:
rows = arcpy.SearchCursor (mapLyr.dataSource)
Jeff
... View more
12-15-2011
12:06 PM
|
0
|
0
|
645
|
|
POST
|
This will be addressed at 10.1. The same script run in 10.1 returns the attached results. Jeff
... View more
12-15-2011
06:46 AM
|
0
|
0
|
1734
|
|
POST
|
Esri does provide a tool. It is called "Calculate Adjacent Fields" and it can be found in the Cartography Tools \ Data Driven Pages toolbox. Yes, it does generate 8 additional fields for your Index Layer but via Dynamic Text, you have absolute control over the placement of the text. Jeff
... View more
12-13-2011
05:58 AM
|
0
|
0
|
1461
|
|
POST
|
You can use the zoomToSelectedFeatures on the DataFrame class: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataFrame/00s300000003000000/ or you can use the getSelectedExtent method on the Layer class (and apply that extent to the data frame object). http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/ Jeff
... View more
12-12-2011
05:12 AM
|
0
|
0
|
1967
|
|
POST
|
This can't be done with Python at 10.0. At 10.1 the arcpy.mapping API has been expanded to includes some renderers (e.g., Graduated Colors, Raster Classified, etc). This will be possible for those renderers. For example,
mxd = arcpy.mapping.MapDocument("current")
lyr = arcpy.mapping.ListLayers(mxd, "MyRasterLyr")
if lyr.symbologyType == "RASTER_CLASSIFIED":
print lyr.symbology.classBreakValues
print lyr.symbology.classBreakLabels
... View more
12-12-2011
05:06 AM
|
0
|
0
|
1107
|
|
POST
|
Have you tried looking into the arcpy.mapping module? There is an export to JPG function. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToJPEG/00s300000038000000/ You can very easily turn on and turn off layers, export, change dataframe extents, etc. The following link is a great starting point: http://blogs.esri.com/dev/blogs/arcgisdesktop/archive/2011/09/30/new-resources-available-for-getting-started-with-python-map-automation.aspx Here is some very basic code:
mxd = arcpy.mapping.MapDocument("current")
#turn off all layers
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.visible = False
#turn one layer on at a time and export
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.visible = True
arcpy.mapping.ExportToJPG(mxd, "C:\\Temp\\"+ lyr.name + ".jpg")
lyr.visible = False
del mxd
... View more
12-06-2011
05:25 AM
|
0
|
0
|
850
|
|
POST
|
Hi Ryan, Have you tried the pageCount property on the PDFDocument object?
pdfDoc = arcpy.mapping.PDFDocumentOpen(path)
print pdfDoc.pageCount
Jeff
... View more
12-06-2011
05:15 AM
|
0
|
0
|
4884
|
|
POST
|
SelectByAttribute works on only one FC at a time. Can't you simply build a list of FCs and loop through them.
lyrs = [lyr1, lyr2, lyr3, etc]
query = ' "AFE_Number' = SomeValue '
for lyr in lyrs:
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", query)
Jeff
... View more
12-02-2011
05:53 AM
|
0
|
0
|
1294
|
|
POST
|
At 10.0 you will have to manage the selection yourself. You will need to run a loop on your rows, create a list of pagenames or numbers and step through each DDP page using that list. Similar to the help sample provided in this thread. At 10.1, we added a DDP.selectedPages property that will return a list of index numbers automatically. Jeff
... View more
11-29-2011
11:04 AM
|
0
|
0
|
824
|
|
POST
|
In 10.0, the only way is to pre-author a layer file with all the appropriate information and then use arcpy.mapping.UpdateLayer. At 10.1, we have introduced some symbology properties for some of the renderers that will allow you to change fields, number of classes, class breaks, etc. Jeff
... View more
11-29-2011
10:53 AM
|
0
|
0
|
2080
|
|
POST
|
There is obviously something wrong. It must have something to do with your MXD and/or data. I recommend that you submit this to support services so we can evaluate the problem. Jeff
... View more
11-28-2011
05:33 AM
|
0
|
0
|
2031
|
|
POST
|
You can also use arcpy.mapping.UpdateLayer. At 10.1 we expanded the arcpy.mapping API to include symbology renderer properties (e.g., class breaks, labels, number of classes, etc.). Jeff
... View more
11-28-2011
05:24 AM
|
0
|
0
|
1032
|
| 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 |
a month ago
|