|
POST
|
Send me a very simple map package with data and a simplified script the reproduces the problem and I'll verify. The original data / script that was used to reproduce the original issue was not longer reproducible when the bug was "fixed". Send map package / script to [email protected] Jeff
... View more
01-09-2014
05:14 AM
|
0
|
0
|
2083
|
|
POST
|
Stretched is currently not supported via arcpy.mapping. Jeff
... View more
12-29-2013
10:36 AM
|
0
|
0
|
2667
|
|
POST
|
Try changing: Wells_lyr.labelClasses[0].showLabels = True to Wells_lyr.labelClasses[0].showClassLabels = True The Layer object has the property showLabels The LabelClass object has the showClassLabels property. Jeff
... View more
12-26-2013
06:19 AM
|
0
|
0
|
2886
|
|
POST
|
You should be able to do this. Try something like:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\ParcelAtlas.mxd")
lyr1 = arcpy.mapping.ListLayers(mxd, "my layer1")[0]
lyr2 = arcpy.mapping.ListLayers(mxd, "my layer2")[0]
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
lyr1.definitionQuery = "SchoolNum = " + pageNum
lyr2.definitionQuery = "SchoolNum = " + pageNum
print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
arcpy.mapping.ExportToPNG(mxd, r"C:\Project\OutPut\ParcelAtlas_Page" + str(pageNum) + ".png")
del mxd
Jeff
... View more
12-23-2013
05:15 AM
|
0
|
0
|
3050
|
|
POST
|
Have you tried using arcpy.mapping. Here is an example from the help that demonstrates how to set the values and labels.
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Census")[0]
lyr = arcpy.mapping.ListLayers(mxd, "StatePopulation", df)[0]
lyrFile = arcpy.mapping.Layer(r"C:\Project\LYRs\Population.lyr")
arcpy.mapping.UpdateLayer(df, lyr, lyrFile, True)
if lyr.symbologyType == "GRADUATED_SYMBOLS":
lyr.symbology.valueField = "POP2000"
lyr.symbology.classBreakValues = [250000, 999999, 4999999, 9999999, 35000000]
lyr.symbology.classBreakLabels = ["250,000 to 999,999", "1,000,000 to 4,999,999",
"5,000,000 to 9,999,999", "10,000,000 to 35,000,000"]
arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\StatePopulation.pdf")
del mxd, lyrFile
Jeff
... View more
12-23-2013
05:09 AM
|
0
|
0
|
2667
|
|
POST
|
I think I understand your requirement. You want your fill symbol angles to always align with the page, not the data. For example if you have a 45 degree cross-hatch symbol and a rotation = 0. Then then both the legend and the cross-hatch symbols are at 45 degrees. If you rotate your data frame 10 degrees, the cross-hatch symbols also rotate 10 degrees (but the legend does NOT). So you have to go into your layer, symbology properties and set the fill angle property to be 35 degrees. The only way I can think of doing this with arcpy.mapping is if you have a limited number of rotation angles. I would author a layer file for each possible rotation and modify the fill angle property. As I go from page to page to page, when setting data frame rotation to a non-zero value, I would update all the appropriate layers with symbology from the matching layer files. I know its a work around but it can work for now. Thanks for defining this requirement. Jeff
... View more
12-13-2013
06:21 AM
|
0
|
0
|
1930
|
|
POST
|
How has it stopped working? Do you have a line number or error message to help narrow down the issue? Jeff
... View more
12-09-2013
06:29 AM
|
0
|
0
|
4197
|
|
POST
|
I think the following code will work better for you. import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Cross Section")[0] dict={} dict[1] = "Page 1" dict[2] = "Page 2" dict[3] = "Page 3" for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum bkmk = arcpy.mapping.ListBookmarks(mxd, dict[pageNum], df)[0] df.extent = bkmk.extent arcpy.mapping.ExportToPNG(mxd, r"D:\\" + str(pageNum) + bkmk.name + ".png") del mxd Here are some comments: - your code was iterating through all bookmarks for each DDP page. I let DDP be the main driver, and then got the bookmark extent for that particular page. - If your bookmark names were identical to the page numbers, it could have been even easier code. - Because your page numbers obviously don't match the page names I created a Python dictionary - it stores the translation (I'm assuming a 1:1 relationship between DDP page number [key] and bookmark [value]). You will need to edit the code to increase the number of key/value-pairs in the dictionary. If there is not a 1:1 relationship and there are more pages than bookmarks, then it will error when it advances to the next DDP page and can't find the corresponding bookmark. - For listBookmarks, we are passing in the dictionary key as the wildcard and it returns the name as the value to do the search on. I hope this helps and have FUN learning arcpy.mapping!!! Jeff
... View more
12-05-2013
05:56 AM
|
0
|
0
|
990
|
|
POST
|
Have you seen these samples: http://www.arcgis.com/home/item.html?id=18c19ec00acb4d568c27bc20a72bfdc8 There are about 20 sample scripts. One is called "Find Data Source" and I believe it does exactly what you want. Jeff
... View more
12-03-2013
06:33 AM
|
0
|
0
|
788
|
|
POST
|
I can not reproduce using similar datasets. Please report to support services so they can work with you in reproducing the issue. Thanks, Jeff
... View more
12-02-2013
12:14 PM
|
0
|
0
|
406
|
|
POST
|
The dynamic legend features were added at 10.1. The only way that I can think to do it at 10.0 would be to build a legend with all possible symbols and text, then break the legend up into individual parts and use arcpy.mapping to automate the building of the legend. Parts not needed would stay off the page and the those in the data view (identified based on queries) would be placed using x/y placement logic. Jeff
... View more
11-20-2013
06:48 AM
|
0
|
0
|
1821
|
|
POST
|
If you really want to call saveACopy to the same file name again and again (in the same script) then you will need to delete your map document variable reference that is holding onto the path.
import arcpy
mxd = arcpy.mapping.MapDocument("C:/temp/blank.mxd")
mxd.saveACopy(r"C:/temp/test3.mxd")
del mxd
mxd = arcpy.mapping.MapDocument("C:/temp/blank.mxd")
mxd.saveACopy(r"C:/temp/test3.mxd")
del mxd
mxd = arcpy.mapping.MapDocument("C:/temp/blank.mxd")
mxd.saveACopy(r"C:/temp/test2.mxd")
del mxd
mxd = arcpy.mapping.MapDocument("C:/temp/blank.mxd")
mxd.saveACopy(r"C:/temp/test3.mxd")
del mxd
Jeff
... View more
11-11-2013
05:19 AM
|
0
|
0
|
1410
|
|
POST
|
Document versioning needs to be added. Please add this to the ideas site. The above idea is good but it only tells you what version of ArcGIS is installed, not what version the MXD is. The text element class is the most useful for this: text.textAngle = 10.2, text.clone=10.1. Jeff
... View more
10-14-2013
06:29 AM
|
0
|
0
|
1517
|
|
POST
|
Susan, I don't know why this is not working for you but I have never tried duplicate index features like you are. This is definately a creative way to use DDP but I don't think this is the correct approach. You are trying to create a thematic map - extent remains the same but different layers or themes are displayed for each page. The approach I would take is to not use DDP and use arcpy.mapping only. Lets say you have 14 different pages because there are 14 different images. To makes things really easy, I would order the images in the TOC the way I want them to be exported. Image 1 / Page 1 at the top, image 14 / page 14 at the bottom of the TOC. Then I would do something like:
import arcpy
mxd = arcpy.mapping.MapDocument(someMXDpath)
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.visible = False
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.visble = True
arcpy.mapping.ExportToPDF(mxd, somePDFpath)
lyr.visble = False
The code obviously needs more logic if there are multiple data frames, sets of layers that are always visible, etc Jeff
... View more
10-10-2013
06:42 AM
|
0
|
0
|
1202
|
|
POST
|
This function can be found in the pythonaddins module. Addins include many additional features for building event driven applications, and as previously mentioned, the ArcMap application would need to be open.
import pythonaddins
mxd = arcpy.mapping.MapDocument("current")
lyr = pythonaddins.GetSelectedTOCLayerOrDataFrame()
print lyr.name
Jeff
... View more
10-09-2013
06:30 AM
|
0
|
0
|
2417
|
| 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
|