Select to view content in your preferred language

Modifying Service Definition Draft file to enable WMS capabilities?

07-14-2021 05:21 AM
Occasional Contributor

I am trying to automate the process of publishing WMS services directly from a raster file without using a map document or project file. I am able to publish an imagery layer or a map image layer but when i try to modify the image draft file to enable the WMS or WFS capabilities and create a new draft file it displays a black image for the image layer and the WMS. Probably because the information from previous file is not copied to the new file and i am not referencing the data in my workflow but rather copying it to the server. How can i enable WMS on my layer? Here is how i implement the image draft file:


arcpy.CreateImageSDDraft(rasterimage, output_draft, service, 'FROM_CONNECTION_FILE', con, True, None, "netCDF test", "test,auto")


Here is how i enable WMS :


typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
    # Get the TypeName whose properties we want to modify.
    if == "WMSServer":
        extension = typeName.parentNode
        for extElement in extension.childNodes:
            # Enabled SOE.
            if extElement.tagName == 'Enabled':
       = 'true'


 Here is how i create a new draft file for storing updated  properties. and here is the problem. The info from previous file is lost and so i see a black image:



f = open(new_draft, 'w')     
doc.writexml( f )     


0 Kudos
0 Replies