Issue with adding raster function template to SD draft

257
0
03-21-2019 03:30 AM
VikshutMundkur
New Contributor

Hi. I am working on automating an image service publishing workflow in arcmap 10.6.

From the python window, I executed the following in sequence:

CreateGISServerConnectionFile

CreateMosaicDataset_management

AddRastersToMosaicDataset_management

CreateImageSDDraft

However, when I executed the following code, the raster function template did not get added to the SD draft. There is no error message either. Hoping for a resolution here!

# Add raster function template to sd draft

import xml.dom.minidom as DOM

functemp = "G:\\RGBComposite.rft.xml,None"

xml = "F:\\Connection\\test_Orthomosaic.sddraft"

dom = DOM.parse(xml)

properties = dom.getElementsByTagName('PropertySetProperty')

for prop in properties:

    keynodes = prop.getElementsByTagName("Key")

    for keynode in keynodes:

            if keynode.firstChild.nodeValue == "rasterFunctions":

                valnodes = prop.getElementsByTagName("Value")

         for valnode in valnodes:

                 if valnode.firstChild == None:

                     valnode.appendChild(dom.createTextNode(functemp))

                 else:

                     valnode.firstChild.replaceWholeText(functemp)

0 Kudos
0 Replies