Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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]
    arcpy.LoadSettings("F:\Projects\Roni\abaloa\gis\layers\b1.dat")
    for bkmk in arcpy.mapping.ListBookmarks(mxd, 'Bookmark1', df):
        df.extent = bkmk.extent
 mxd.save()
 del mxd  

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

share|improve this question

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer
    
Thanks, but I'm writing 'ןאי Python language, how can I change the code I wrote in order to be able to perform the operation –  Yaron Jul 14 at 6:09
    
With the current version of arcpy - you can't . –  Alex Tereshenkov Jul 14 at 6:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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