I am new to both ArcGIS and Python. My requirement is to automate the below MANUAL process:
- Creating a layer in ArcGIS for Desktop. To put it in another words, creating an ArcMap document (.mxd).
- Publishing the created ArcMap document (in Step 1) as a service to ArcGIS Server.
Currently we are doing this manually. I have come across scripts to automate step 2 using Python.
How can I automate step 1 and step 2?
Best Answer
This isn't really a standalone answer, more of an addition to @PolyGeo's answer as it addresses the 'mxd creation from scratch' in python issue.
You can create MXD's from scratch in python if you access ArcObjects. You will need the comtypes package and if using ArcGIS 10.1, you need to make a small change to
automation.py
. See ArcObjects + comtypes at 10.1Below is some code to create an MXD from scratch in python: