Bookmark

サマリー

Provides access to bookmark methods and properties.

説明

Bookmarks in an ArcGIS Pro project are associated and managed with the map for which they were created. They are referenced using the listBookmarks method on the Map object. If you want to search all bookmarks within a project, you must iterate through all the maps. Bookmarks can be used to update the display for a MapFrame object on a page layout using the zoomToBookmark method.

Despite the fact that a bookmark is associated with a specific map, a bookmark can be used on map frames that are displaying different maps. Bookmarks created using a 2D map can be used with 3D maps and the other way around. It is at the time of bookmark creation that the available Camera object properties are set based on the type of map. If a 2D bookmark is used for either a local or global map viewing mode, then the result will be a planimetric view of the area of interest. If a 3D bookmark is used with a 2D map frame type, the 3D camera properties are approximated to provide a planimetric extent.

There are a couple of scenarios where a bookmark's thumbnail image will need to be updated. First, bookmarks imported from map (.mxd), globe (.3dd), or scene (.sxd) documents don't automatically have their thumbnails updated due to a performance hit—it could take a long time for the application to automate this process because each bookmark area of interest would need to be generated and layers fully drawn before a thumbnail could be created. Second, the data in a map, for example, a basemap, may get changed and you may want the thumbnails to get updated appropriately. The updateThumbnail method provides a solution for these two scenarios. The hasThumbnail property allows you to determine which bookmarks may have been imported and don't currently have a thumbnail image.

プロパティ

プロパティ説明データ タイプ
hasThumbnail
(読み取り専用)

If True, a thumbnail image is associated with a bookmark.

Boolean
map
(読み取り専用)

The Map that the bookmark is associated with.

Map
name
(読み書き)

The name of the bookmark.

String

方法の概要

方法説明
updateThumbnail ()

Updates a bookmark's thumbnail image.

方法

updateThumbnail ()

Updates a bookmark's thumbnail image. To determine if a thumbnail exists for a bookmark, check the hasThumbnail property.

コードのサンプル

Bookmark example 1

The following script will update a map frame's area of interest by zooming to each bookmark that belongs to a map named Yosemite National Park and export the result to individual PDF documents.

import arcpy, os
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")

lyt = aprx.listLayouts("Main Attractions*")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT", "Yosemite National Park*")[0]

bkmks = mf.map.listBookmarks()
for bkmk in bkmks:
  mf.zoomToBookmark(bkmk)
  lyt.exportToPDF(os.path.join(r"C:\Projects\YosemiteNP", f"{bkmk.name}.pdf"))
del aprx
Bookmark example 2

The following script will iterate through all the bookmarks in a project and update the thumbnail image if it is missing.

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
for m in aprx.listMaps():
  for bkmk in m.listBookmarks():
    if bkmk.hasThumbnail == False:
      bkmk.updateThumbnail()
aprx.save()
del aprx