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?
-
5It'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.Vince– Vince2017年04月12日 17:57:49 +00:00Commented Apr 12, 2017 at 17:57
1 Answer 1
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:
- Use
arcpy
site-package that comes with ArcGIS. - 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 usingcomtypes
here. - Read binary data and try to parse. There is code that tries this here.
Explore related questions
See similar questions with these tags.