Adding a bookmark with python

2866
5
11-20-2017 02:07 PM
SteveGautreau
New Contributor II

Is it possible to add a bookmark to the mxd of the current dataframe's extent, using python?

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

ListBookmarks but.... nothing under the functions list....  arcpy mapping focuses on getting rather than giving for the mostpart

SteveGautreau
New Contributor II

Thanks Dan. 

This however seems to apply to bookmarks that already exist in the map.  

Rather than setting the dataframe extent to a given bookmark, I want to create a bookmark based on the current dataframe extent.

0 Kudos
DanPatterson_Retired
MVP Emeritus

you missed the last link... you have to have the bookmarks already... there is no way in the mapping module (aka arcpy) to do this.  It doesn't even exist in ArcGIS pro either.

So short of some potential arcobjects/.Net/other development language, it can't be done.

Now... if you have a bookmark, you can get it. That is a different question and that can be done. Meaning that you should be able to get the extent of the bookmark (no guarantee, I haven't looked into it given your initial question).

Extent object... then from the extent object, you can go to the 

Dataframe object and there is a pantoextent and zoomtoselected features etc etc.

So in theory you should be able to use existing bookmarks... just not create them.

0 Kudos
SteveGautreau
New Contributor II

Thanks Dan. Yes I am able to reference bookmarks that already exist in

arcpy. I figured the answer was the one you gave me - Its not possible to

add bookmarks except with the GUI of arcgis.

Thank you kindly for the quick response!

Steve

0 Kudos
DanPatterson_Retired
MVP Emeritus

no problem

0 Kudos