Select to view content in your preferred language

Create and Publish Map Service without .MXD Via Python ?

416
1
12-02-2022 09:08 PM
victhomas
Occasional Contributor

Hello all,

just have a few questions, if you guys can help much is appreciated.  I wanted to see if it's possible the create a map service, then publish it to ArcGIS Server without creating an .mxd file using Python/Arcpy? 

script pseudo: 

- connect to db

- grab the fc/table

- load said fc/table to map document, set parameters i.e. don't show zoom beyond 1:1,000,000

-  use CreateMapSDdraft to create sddraft from said fc/table

-  analyze the sddraft file 

- then publish the sddraft file with ArcPy UploadServiceDefinitionserver

Would the above workflow be possible without needing to create a .mxd and saving it in a file directory? 

Tags (2)
1 Reply
RhettZufelt
MVP Notable Contributor

You will need to mapping module to add/configure, etc. the layers anyway, but don't know that it will actually publish the service without mxd.save().  You would need to test it and see if the changes are reflected in the service without saving the mxd. 

In worst case, you could create/modify/save the mxd, publish the service, then delete the intermediate mxd file.

R_

0 Kudos