1

The only output format permitted by the ArcMap bookmark manager (v10.7) is an "ArcGIS place file (*.dat)" which is not entirely human-readable when opened in a text editor.

What is the file structure of an ArcGIS Place File? suggests it may not be possible to access content directly and probably requires ArcObjects to extract bookmark info.

Is there another way to transfer bookmarks from ArcMap so that they are suitable to be read by QGIS?

0

2 Answers 2

3

Rather than output bookmarks as an ArcGIS Place File (*.dat) you can use the ListBookmarks function of ArcPy which:

Returns a Python list of named tuples that provide access to each spatial bookmark's name and extent.

With that simple data structure available within Python you could write to a file format of your choice or just read it direct using PyQGIS.

3
  • I'm running into trouble getting the bookmarks into QGIS (the other half of my question). Should I append to my original question or retitle this one and start a new one?
    – CreekGeek
    Commented May 6, 2021 at 5:29
  • 1
    @CreekGeek I think we already have a focused Q&A asked and answered here so I think the best way forward is to ask a new question. I'll re-frame this one as "Outputting bookmarks in TXT file using ArcPy" and suggest you ask the new question about "Inputting bookmarks from TXT file using PyQGIS".
    – PolyGeo
    Commented May 6, 2021 at 5:51
  • Sounds good. Cheers.
    – CreekGeek
    Commented May 6, 2021 at 7:58
2

Working from @PolyGeo's answer, here's some code that gets the info out of ArcMap:

import arcpy

srcPath = "D:\\SomeFolder\\Data\\"
srcFile = "MyMap.mxd"


# set working mxd
mxd = arcpy.mapping.MapDocument(srcPath+srcFile)

with open(srcPath+'filename.txt', "w") as outtxt:
for df in arcpy.mapping.ListDataFrames(mxd,"*"):
    for bkmk in arcpy.mapping.ListBookmarks(mxd, "", df):
        e = bkmk.extent
        CRS=2193
        tmp_lst = list((bkmk.name.encode("utf-8").replace(" ","").replace("-","_"),"SomeName",e.XMin,e.YMin,e.XMax,e.YMax,CRS))
        str_lst = ','.join(str(t) for t in tmp_lst)
        outtxt.write(str_lst+"\n")            
        

posted earlier today...works, but not as tidy:

out_lst = []

# list frames within mxd
for df in arcpy.mapping.ListDataFrames(mxd,"*"):
    for bkmk in arcpy.mapping.ListBookmarks(mxd, "", df):
        e = bkmk.extent
        out_lst.append([bkmk.name.encode("utf-8"), e.XMin,e.YMin,e.XMax,e.YMax,df.rotation,df.scale])


with open(srcPath + "file.txt", "w") as output:
    output.write(str(out_lst))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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