Created
November 5, 2017 09:08
-
-
Save AlexArcPy/bbba9a77866e34b9e3d55de39812b43c to your computer and use it in GitHub Desktop.
Create a new empty ArcGIS map document (.mxd) with Python (comtypes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from comtypes.client import GetModule, CreateObject | |
from snippets102 import GetStandaloneModules, InitStandalone | |
esriCarto = GetModule(r"C:\Program Files (x86)\ArcGIS\Desktop10.5\com\esriCarto.olb") | |
# First time through, need to import the “StandaloneModules”. Can comment out later. | |
GetStandaloneModules() | |
InitStandalone() | |
# Create a map document object | |
mxdObject = CreateObject(esriCarto.MapDocument, interface=esriCarto.IMapDocument) | |
# Create new mxd file | |
mxdObject.New(r'C:\Temp\MapTemplate.mxd') | |
mxdObject.Save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment