|
POST
|
To address the issue of replacing an SDE raster image with a raster mosaic, have you tried arcpy.mapping.UpdateLayer with symbology_only=False? Author a layer file pointing to your raster mosaic and then find and update your SDE raster images found within your MXDs. UpdateLayer has the ability to completely swap our entire layers (including data type). Jeff
... View more
02-14-2012
05:13 AM
|
0
|
0
|
1586
|
|
POST
|
As an alternative, why can't you just use a masking layer? The masking layer can "white out" the zone outside the area of interest before the export is done. This can be done in the user interface with Data Driven Pages using page definitions (via the definition query tab). Or it can be done with arcpy.mapping in a similar way but by automating the updating of definition queries. Jeff
... View more
02-13-2012
05:40 AM
|
0
|
0
|
3583
|
|
POST
|
I'm currently working with a customer on this exact issue. They have 320 map sheets. Each sheet can have anywhere from 0 to 6 inset maps. In addition to the insets, they also have 3 tabular reports. Depending on the size and shape of the primary map, all the other items (insets and reports) get placed at different locations. The solution we are building is to store all the page layout info (x,y, width, height, extent, etc) of each element in a table. As we iterate through each map sheet, the appropriate info is read and the appropriate items are positioned. This application will be posted to the Resource Center when complete. We just started so it will take some time. Jeff
... View more
02-02-2012
05:21 AM
|
0
|
0
|
2353
|
|
POST
|
Yes. Have you tried something like:
import arcpy
mxd = arcpy.mapping.MapDocument("path to mxd")
lyr = arcpy.mapping.ListLayers(mxd, "layer name")[0]
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "some query")
mxd.save()
#If you don't want to save the selection to the existing MXD, try saving it to another file:
mxd.saveACopy("path to new MXD")
Jeff
... View more
02-02-2012
05:08 AM
|
0
|
0
|
698
|
|
POST
|
With arcpy.mapping you can get the following SDE properties using the serviceProperties property on the Layer object. Keys for an ArcSDE dictionary ServiceType �??The property displaying the type of service. This will only be SDE for ArcSDE layer types. Server �??The name or IP address of the computer where the ArcSDE geodatabase is located. Service �??The name or port number of the process running on the ArcSDE server. Database �??The name of the enterprise RDBMS database. This is not required when using Oracle. UserName �??A user account. This will be blank if using operating system authentication. AuthenticationMode �??Geodatabase or operating system authentication. Version �??The version of the geodatabase to which you are connecting. There is a code sample that uses this property. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/ Jeff
... View more
01-31-2012
05:10 AM
|
0
|
0
|
1131
|
|
POST
|
It is because you are assigning "PDF_MULTIPLE_FILES_PAGE_INDEX" to the wrong parameter. You are assigning it to {page_range_string} and not {multiple_files}. To skip {page_range_string} and assing {multiple_files} try: tempDDP.exportToPDF(temp_filename, "SELECTED",multiple_files="PDF_MULTIPLE_FILES_PAGE_INDEX") If you want to skip parameters in Python you must type in the parameter name. Jeff
... View more
01-27-2012
07:45 AM
|
0
|
0
|
1218
|
|
POST
|
I looked at your data. If I understand this correctly, you are trying to do something that is a lot more than just setting the extents of 3 data frames. Your upper data frame appears to contain the equivalent of 3 strip map pages, each at a different angle to one another. The data frame below that shows the pipeline running through the 3 pages but it is flattened to run horizontal to the bottom of the page (i.e., profile map). The only way I can think of doing this with Python is to make the middle data frame (and bottom) 3 separate data frames, one for each stripmap page. The trick will be to get the rotation of each stripmap page and then rotate the 3 separate data frames so they are all horizontal to each other. You will also need to calibrate your extents based on the rotation so that you can place each dataframe next to one another to create the appearance of 3 horizontal dataframes that appear a one. I find this interesting but this goes far beyond answering a question about setting data frame extents. The dataframe object allows you to set its extent and also allows you to rotate. I believe this is what you would need to do. Jeff
... View more
01-19-2012
07:52 AM
|
0
|
0
|
2353
|
|
POST
|
You can also zoom the selected features in a specific layer.
arcpy.SelectLayerByAttribute_management(sectorlayer,"NEW_SELECTION")
df.extent = sectorlayer.getSelectedExtent()
arcpy.SelectLayerByAttribute_management(sectorlayer,"CLEAR_SELECTION")
Jeff
... View more
01-19-2012
07:07 AM
|
0
|
0
|
1345
|
|
POST
|
Not sure what an rar file is. Could you provide a zip? Jeff
... View more
01-17-2012
11:55 AM
|
0
|
0
|
2353
|
|
POST
|
I'm fairly certain we addressed the memory issues discovered prior to SP2. That does NOT mean you didn't find something else. It sounds like you are surprised that there are so many elements in your MXD. Have you tried saving it out to a new file? Have you tried determining what the extra objects are and deleting them? Here is a trick that I use to minimize the number of times I call ListLayoutElements because every time you call it, it must iterate through all of your elements:
for elm in arcpy.mapping.ListLayoutElements(mxd):
if elm.name == "title": title = elm
if elm.name == "north arrow": northArrow = elm
if elm.name == "graphic": graphic = elm
The above code calls ListLayoutElements once vs 3 separate times like below:
title = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "title")[0]
northArrow = arcpy.mapping.ListLayoutElements(mxd, "MAPSURROUND_ELEMENT", "north arrow")[0]
graphic = arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "graphic")[0]
I hope this helps, Jeff
... View more
01-13-2012
05:55 AM
|
0
|
0
|
1434
|
|
POST
|
There could be a variety of possibilities. It could be memory leak (are you watching memory usage during run time?), there could be an issue with the PDF libraries, etc. We won't really know unless we have a reproducible case. Is there any way you can package your data and make it available to Support Services so we can evaluate the problem? Thanks! Jeff
... View more
01-13-2012
05:27 AM
|
0
|
0
|
1497
|
|
POST
|
Andrew is correct, you can't change the fixed extent option via arcpy,mapping. By design we even block you from trying to change the extent via arcpy.mapping if the map document was authored to be fixed extent. We are trying to keep arcpy.mapping simple and NOT have it do everything that can be done in ArcMap (thats ArcObjects). But I am curious if you have a scenario that requires that you really need to toggle this "fixed extent" setting. With arcpy.mapping, you have total control over extent, scale, etc so it simply makes the most sense to me that you set the extent to automatic but please let me know otherwise. Jeff
... View more
01-12-2012
06:11 AM
|
0
|
0
|
1536
|
|
POST
|
I think we have a fix. arcpy.MakeFeatureLayer works well in CURRENT because it automatically adds the result to the current MXD. If you use a script tool or run as a stand alone script you need to modify your code as follows to make a layer object from MakeFeatureLayer and manage it accordingly: selLyr = arcpy.MakeFeatureLayer_management(flumlyr, "FLUM_Select").getOutput(0) #added variable at beginning and .getOutput at end to return a real layer object arcpy.ApplySymbologyFromLayer_management(selLyr, flumlyr) #changed the first parameter arcpy.mapping.AddLayer(df, selLyr) #new line - this added a real layer object (and also to the legend if the legend is set up to auto add new layers) Jeff
... View more
01-11-2012
12:05 PM
|
0
|
0
|
1426
|
|
POST
|
I believe the issue was that you were setting the new pageName variable before changing the currentPageID. I swapped the two lines. I just tried the following and it worked:
import arcpy, os
mxdPath = r"C:\Temp\DDP.mxd"
mxd = arcpy.mapping.MapDocument(mxdPath)
mxdDir = os.path.dirname(mxdPath)
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
pageName = mxd.dataDrivenPages.pageRow.NAME
mxdName = os.path.join(mxdDir, "_" + str(pageName) + ".mxd")
print mxdName
mxd.saveACopy(mxdName)
del mxd Jeff
... View more
01-11-2012
08:50 AM
|
1
|
0
|
6774
|
|
POST
|
There are a couple of already existing samples on the resource center: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=A910AB18-1422-2418-3418-3885D388EF60 There is one called Print Data Driven Page(s). Jeff
... View more
01-07-2012
04:44 PM
|
0
|
0
|
2614
|
| 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
|