0

Right now i am sharing a map service in ArcGIS by following these steps.

File --> Share as --> Service --> then click on overwrite an existing service --> select appropriate map --> Click on Analyse --> Publish service.

Is it possible to do all this task with a small python code?

0
1

I searched for "arcpy publish map service" and found Publishing a map service with Python:

You can automate map service publishing in a Python script. To do this, you need to call the following sequence of functions from the arcpy.mapping module and tools from the Server toolbox.

5
  • 1
    Looks like it's the same content, but just in case it changes, here's the link to the 10.3 version of the linked documentation: server.arcgis.com/en/server/latest/publish-services/windows/… – GavinR Aug 30 '15 at 3:10
  • frankly all existing sample codes over the web are not smart enough, you always need to enter the the mxd name! I am looking forward a code that you can enter only the path of the folder that contains all of my mxd's (around 80 mxd) then it will do the job of publishing and print the errors ( not published mxd) to a text file. there should be a way to do a loop inside theses codes to automate the work and skip the errors – Ahmad saleh Jan 15 '17 at 18:56
  • 1
    @Ahmadsaleh it isn't really an arcpy function to find and loop through files - that is thoroughly covered in the native Python functionality (e.g. the os module) and is fairly trivial - so it's not included in GIS examples. Do a search on StackOverflow for file looping and plug the 2 together – brichins Jul 26 '17 at 21:12
  • Does the solution support publishing to ArcGIS Online? – alextc Nov 29 '17 at 5:06
  • @alextc I've not tried it – PolyGeo Nov 29 '17 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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