Does anyone know any python script to use for arcview to import a bookmark (saved as a .dat) that was created and saved externally using ArcMap? I tried with this script but without a result:

import arcpy
from arcpy import env

env.workspace = r"F:\Projects\Roni\abaloa"
for mxdname in arcpy.ListFiles("*.mxd"):
    print mxdname
    mxd = arcpy.mapping.MapDocument(r"F:\Projects\Roni\abaloa\\" + mxdname)
    df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
    for bkmk in arcpy.mapping.ListBookmarks(mxd, 'Bookmark1', df):
        df.extent = bkmk.extent
 del mxd  

I've also searched all documentation and forums with no luck.


As PolyGeo outlined, you cannot transfer bookmarks from one map document to another with arcpy. What you can do, however, is:

  1. You can list your bookmarks in a map document with arcpy.ListBookmarks function (you will get name and extent). The extent information can be used to create features which you can save into a feature class (at least something).

  2. You can use ArcObjects to create bookmarks based on the extent information you have obtained. See here and here to learn more.


The function that you tried i.e. LoadSettings (arcpy) will load Geoprocessing environment settings:

Loads environment settings from an environment settings file (text stored in an Extensible Markup Language [XML] schema).

but Bookmarks are stored with the properties of a Data Frame object and so will not be altered by that.

However, there is an existing ArcGIS Idea entitled Create Bookmark Toolbox that, if implemented, would deliver the functionality that you seek.

Consequently, I recommend that you add your vote to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.