|
POST
|
Here is a help topic sample. If you join the beta community you'll be able to try out so much more of the arcpy.mapping functionality that was added at 10.1. ListBookmarks example 2 Similar to example 1, the following script will loop through each bookmark in the Transportation data frame, set the data frame extent, and export the data frame to a JPEG file. import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
df.extent = bkmk.extent
outFile = r"C:\Project\Output\\" + bkmk.name + ".jpg"
arcpy.mapping.ExportToJPEG(mxd, outFile, df)
del mxd
... View more
10-08-2011
11:44 AM
|
0
|
0
|
3229
|
|
POST
|
Could you please provide a little more information? Are you doing this in the UI, are you using arcpy.mapping? Thanks, Jeff
... View more
10-08-2011
11:38 AM
|
0
|
0
|
2937
|
|
POST
|
I think I know the problem. The simple solution is to first try: desc = arcpy.Describe(lyr) and not desc = arcpy.Describe(lyr.dataSource) The longer explanation: I had someone in my office sent me a layer file created using 9.3 Desktop to a 9.3 SDE (as well as a 10.0 layer file pointing to a 10.0 SDE). When I added their layer file to my 10.0 map document it displayed just fine, that is because we are on the same network and I can connect to the same SDE server as they can (I'm thinking this is similar to your workplace environment). But when I run the following I get the same error message that you are seeing: >>> mxd = arcpy.mapping.MapDocument("current") >>> lyr = arcpy.mapping.ListLayers(mxd)[0] >>> print lyr.dataSource C:\Users\UserName\AppData\Roaming\ESRI\ArcCatalog\demo.sde\sde.DBO.layer >>> desc = arcpy.Describe(lyr.dataSource) Runtime error <type 'exceptions.IOError'>: "C:\Users\UserName\AppData\Roaming\ESRI\ArcCatalog\demo.sde\sde.DBO.layer" does not exist This is because the layer file is persisting the original connection information as a property. When I print lyr.dataSource I get the path to the connection file above. The .sde file does NOT exist on my local machine so we should expect it to fail because that is what it is looking for. When we remove the lyr.dataSource and use desc = arcpy.Describe(lyr) >>> print desc.spatialReference.name GCS_WGS_1984 It works because it is using the current connection info rather than the property stored on the layer file. If I create a new local connection and if I perform a lyr.replaceDataSource using my local SDE connection file info, both methods work without error. Jeff
... View more
10-08-2011
11:36 AM
|
0
|
0
|
749
|
|
POST
|
When using List functions in arcpy.mapping you will always need to use the index number at the end: myLayer = arcpy.mapping.ListLayers(mxd, "filter")[0] This will return a layer object myLayer = arcpy.mapping.ListLayers(mxd, "filter")[0] This will return a Python list object Also - there way most likely a typo in your filter. Try using wildcard. myLayer = arcpy.mapping.ListLayers(mxd, "Bay, Lakes*")[0] Jeff
... View more
10-07-2011
06:52 AM
|
0
|
0
|
2387
|
|
POST
|
Check out the following sample scripts: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=A910AB18-1422-2418-3418-3885D388EF60 There are some reporting tools that do exactly what you want. Jeff
... View more
10-07-2011
06:44 AM
|
0
|
0
|
2464
|
|
POST
|
You are on the right track. Check out the samples for MakeFeatureLayer. Also check out arcpy.mapping.AddLayer. Jeff
... View more
10-07-2011
06:35 AM
|
0
|
0
|
3499
|
|
POST
|
Dynamic tables won't work with Data Driven Pages. Adding tables to a layout worked well for single page MXDs. This is something we plan to address in a future release (it won't be 10.1). A Python solution is available that simulates dynamic "graphic" tables. Check out the following link on the Resource Center: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=8C8E6EB6-1422-2418-A0B8-6AA61BF57894 I hope this helps, Jeff
... View more
10-06-2011
06:50 AM
|
0
|
0
|
856
|
|
POST
|
arcpy.ApplySymbologyFromLayer is very similar to arcpy.mapping.UpdateLayer (with more options than just symbology). As mentioned above, you still need to author a layer file ahead of time - there is no way to automate the symbology changes. Jeff
... View more
10-06-2011
06:33 AM
|
0
|
0
|
1866
|
|
POST
|
And this is why we only need to provide a path to the workspace, which in your case is the .gdb. A good document that addresses different update data source scenarios is found at the follolwing link. It even includes a scenario that involves feature data sets. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/ Jeff
... View more
10-05-2011
07:00 AM
|
1
|
0
|
2143
|
|
POST
|
I'm not sure you can even do this in the user interface. But once you have all your label symbol colors matching the line symbol colors you could save the results to a layer file. With arcpy.mapping you can update the symbology of other layers in other map documents or layer files using the UpdateLayer function. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/UpdateLayer/00s30000003p000000/ This scenario will not be possible with 10.1 using arcpy. At 10.1 we've introduced a limited set of symbology renderers to the arcpy.mapping API (e.g., Raster Classified). With these new classess you can change the number of classes, change min/max values, class break values, etc. There is nothing in the new API that allows you to change label symbols. Jeff
... View more
10-05-2011
06:55 AM
|
0
|
0
|
1866
|
|
POST
|
When specifying the new workspace name, do NOT include the name of the feature dataset. The workspace is simply the path to the .gdb (in your case). The feature dataset will automatically get resolved. newWorkspace = r"Z:\Data\Boundaries\Administrative\Lummi.gdb\TribalBoundaries" should be newWorkspace = r"Z:\Data\Boundaries\Administrative\Lummi.gdb" Jeff
... View more
10-04-2011
06:46 AM
|
1
|
0
|
2143
|
|
POST
|
Data Driven Pages (DDP) uses one index layer to drive extents. If your two data frames on each page have different extents then I don't think you can do this with only DDP. If both of your data frames have the same extent (but display different layers) you could do this. See the following help topic: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Customizing_your_map_extent/00s900000011000000/ Your scenario can be accomplished with the arcpy.mapping scripting environment. You would set the two data frame extents independantly using whatever method you need. Jeff
... View more
10-04-2011
06:37 AM
|
0
|
0
|
4794
|
|
POST
|
It is not possible to change pagesizes with arcpy. The best workflow would be to author an individual MXD for each pagesize. Then generate each page of the atlas using the appropriate MXD. A great example of this in help is Creating a Map Book with Facing Pages: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_a_map_book_with_facing_pages/00s90000002p000000/ Jeff
... View more
10-02-2011
08:08 PM
|
0
|
0
|
646
|
|
POST
|
Tables inserted into a layout can't be dymanically updated via arcpy. There is a sample that simulates dynamic tables in a layout. The table itself is a graphic and the values are text elements that get updated by reading the dataset. Here is a link: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=8C8E6EB6-1422-2418-A0B8-6AA61BF57894 Jeff
... View more
09-30-2011
01:55 PM
|
0
|
0
|
891
|
|
POST
|
Getting started with Python map automation (arcpy.mapping) ArcGIS 10 provides a new Python mapping module (arcpy.mapping) that allows you to interact with the contents of map documents and layer files without necessarily needing to interactively open an ArcMap session. The methods, properties and functions available in this new map scripting API enable you, for example, to automate changing data sources, modify layer properties, export and print maps, as well as automate the creation of thematic maps and map series. Because the new mapping module is part of the ArcPy geoprocessing framework, scripts can be used within ArcGIS Desktop but also published to ArcGIS Server as geoprocessing services making it much easier to make mapping and printing capabilities available on the server. The following links are resources that will help you learn more about arcpy.mapping as well as sample scripts available for download: Help Resources �?� A new "Introduction to arcpy.mapping" help topic is a great starting point. It includes links to a new arcpy.mapping tutorial and general guidelines for working with arcpy.mapping. ArcGIS Desktop help has a complete section dedicated to the ArcPy mapping module. Embedded within the help topics are over 100 different, practical help samples that can be copied/pasted into your applications. Be sure to review the "Best ways to get started" section. [INDENT]http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Introduction_to_arcpy_mapping/00s300000032000000/[/INDENT] �?� A video presentation called �??Python Scripting for Map Automation in ArcGIS 10�?� presented at the 2011 Developer�??s Summit is an excellent starting point. This presentation not only introduces arcpy.mapping but also demonstrates many of its use cases. [INDENT]http://resources.arcgis.com/gallery/video/geoprocessing/details?entryID=E15FA297-1422-2418-A0B0-270A0BBB3E57[/INDENT] �?� Another video presentation called "Arcpy.mapping: Export a map in PDF format from a web browser" that demonstrates how arcpy.mapping scripts can be published as geoprocessing services and published to web applications. [INDENT]http://resources.arcgis.com/gallery/video/geoprocessing/details?entryID=4B0F346D-1422-2418-342A-026EA4547313[/INDENT] Sample Applications �?� Approximately 20 script tools that perform routine map and layer management tasks, printing and exporting, as well as basic cartographic operations. This is an excellent download because it includes many practical code samples that perform a variety of tasks and they are easy enough to modify for your own purposes. [INDENT]http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=A910AB18-1422-2418-3418-3885D388EF60[/INDENT] �?� A script tool that combines Data Driven Pages, arcpy.mapping, and the ReportLab site package to generate a reference map book that includes street index pages. It demonstrates how arcpy.mapping can be used to extend Data Driven Pages capabilities. [INDENT]http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=FBE3D235-1422-2418-8820-E071ED243854[/INDENT] �?� A script that incorporates Data Driven Pages and arcpy.mapping to build a map series that includes dynamic graphic tables. There is a very complete README.doc file included with the download that also addresses other useful tips and tricks that go along with the application. [INDENT]http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=8C8E6EB6-1422-2418-A0B8-6AA61BF57894[/INDENT] Web Courses �?� Basics of Python (for ArcGIS 10). This course teaches fundamental concepts you need to know to create Python scripts in ArcGIS. You will learn guidelines for proper Python syntax, techniques to troubleshoot common errors, and how to use loops to test for conditions and execute different code based on the result. [INDENT]http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseid=2114[/INDENT] �?� Python Scripting for Map Automation in ArcGIS 10. This course teaches how to automate map production and related data management tasks that would be time-consuming and tedious to perform manually. You will learn how to work with the mapping module of the ArcPy site package to quickly and easily update map layers and map document properties, modify map content, and produce individual maps and map books. [INDENT]http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseid=2054[/INDENT] Jeffrey Barrette | Product Engineer
... View more
09-29-2011
06:31 AM
|
0
|
2
|
4958
|
| 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 |
4 weeks ago
|