ArcGIS Закладки роздрукувати окремими листками

Post date: Oct 8, 2013 2:57:12 PM

У мене є великий проект в ArcGIS з різним ступенем Використання закладок для переміщення між цими сторінками.

Питання в тому, чи можна конвертувати закладки сторінок так щоб роздрукувати кожну. Відповідь є через використання скриптів:

Скрипт конвертує закладки в полігони які можна використати в інструметі Data Drivaine Pages і вивести на друк посторінково.

## We have this large project in ArcGIS with 30 maps with different extents using Bookmarks to pan between these #maps/pages.Now we would like to use Data driven pages instead. The question is, is it possible to convert bookmarks to #data driven pages or do we have to create a lot of polygons covering each map extent?

import arcpy

# The map with the bookmarks

mxd = arcpy.mapping.MapDocument(r"C:\polygeo\Maps\Bookmarks.mxd")

# Make sure that Training.gdb exists

fileGDBFolder = (r"C:\polygeo")

fileGDBName = ("Training.gdb")

fileGDB = fileGDBFolder + "\\" + fileGDBName

if not arcpy.Exists(fileGDB):

    arcpy.CreateFileGDB_management(fileGDBFolder, fileGDBName)

# The output feature class to be created -

# This feature class will store the bookmarks as features

fcName = "Bookmarks"

outFC = fileGDB + "\\" + fcName

# Create new feature class and add a "Name" field to store the

# bookmark name.  Provide it with the same Spatial reference as

# the data frame in which the bookmarks of the map are stored

if arcpy.Exists(outFC):

    arcpy.Delete_management(outFC)   

arcpy.CreateFeatureclass_management(fileGDB,

                                    fcName, 

                                    "POLYGON", 

                                    spatial_reference=arcpy.SpatialReference(

                                        "c:\polygeo\New_Shapefile.prj"))#There is important choese the prj file

arcpy.AddField_management(outFC, "Name", "TEXT", "", "", 50)

# Use arcpy.mapping.ListBookmarks to read bookmark corners and names,

# then arcpy.da.InsertCursor to write arrays of Point geometries from

# that can be written as Polygon geometries to the Shape field of the

# new feature class (with their names).

cur = arcpy.da.InsertCursor(outFC, ["SHAPE@", "Name"])

array = arcpy.Array()

for bkmk in arcpy.mapping.ListBookmarks(mxd):

    array.add(arcpy.Point(bkmk.extent.XMin, bkmk.extent.YMin))

    array.add(arcpy.Point(bkmk.extent.XMin, bkmk.extent.YMax))

    array.add(arcpy.Point(bkmk.extent.XMax, bkmk.extent.YMax))

    array.add(arcpy.Point(bkmk.extent.XMax, bkmk.extent.YMin))

    # To close the polygon, add the first point again

    array.add(arcpy.Point(bkmk.extent.XMin, bkmk.extent.YMin))

    cur.insertRow([arcpy.Polygon(array), bkmk.name])

    array.removeAll()

del bkmk,array,cur,mxd

print "Bookmarks feature class has been created in " + fileGDB

Джерело