1

I am an old user of Python, but relatively new to GIS. I have a .mxd file and would like to read it into Python.

Is arcpy the only way to do so?

I tried with pyshp but it does not accept this file extension.

Is there perhaps another package for python3 for working with data in this format?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 12, 2017 at 17:50
1
  • 5
    It's a proprietary binary format. You could read the bytestream, but you'd have to reverse-engineer it to have meaning, and the format mutates with each release. Finally, it doesn't contain much data, just metadata. Commented Apr 12, 2017 at 17:57

1 Answer 1

4

Mxd files are map documents containing information:

  • references to the data sources;
  • map layer symbology;
  • map document metadata;
  • optionally layout configuration;
  • some GUI layout information.

Since it is a binary file, you would need to use a piece of software that is capable of reading it. If you would like to get access to the file programmatically specifically using Python you have really three options:

  1. Use arcpy site-package that comes with ArcGIS.
  2. Use Python comtypes package that can provide an interface to ArcObjects (the COM objects ArcGIS is built upon). Read more on how you can access ArcObjects using Python in this post. There is a post on reading version of mxd file using comtypes here.
  3. Read binary data and try to parse. There is code that tries this here.
answered Apr 12, 2017 at 19:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.