0

My web app will (hopefully) use dynamic layers with symbols that are rendered dynamically, based on a user chosen attribute. So far I am doing this by defining a UniqueValueRenderer, then passing these properties to a layer with LayerDrawingOptions. My work so far is loosely based on this example.

I periodically add new layers to the map and then re-publish them with a Python script using ArcPy. As far as I know, ArcPy does not provide a way to overwrite an existing map service (please correct me if I am wrong! ) So instead, I delete, then publish, the map service from scratch.

So here is my issue: to allow dynamic symbol rendering in my map services, I need to enable per request modification of the services, which I can do in Manager for the services on that server (see image below). But, I have not found a way to do this with ArcPy. Once the map services are re-published, as of now I need to then log into Manger and manually check the 'allow modification' checkbox, and also re-register the file gdb as a dynamic workspace. I have several map services in this app that need to redner symbols dynamically. (This question is also posted on ESRI's Geonet here

from ArcGIs for Server, Capabilities tab - I cannot find this functionality in ArcPy or when publishing an mxd manually

0

Here is the answer, from ESRI support:

...
import xml.dom.minidom as DOM 
...

            analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER', 
                                                      con, True, serviceFolder, summary, tags)


            doc = DOM.parse(sddraft)
            keyps = doc.getElementsByTagName('Key')
            for keyp in keyps:
                if keyp.firstChild.data == 'enableDynamicLayers': keyp.nextSibling.firstChild.data = 'true'


            newXML = wrkspc + service + r'_NEW.sddraft'
            f = open(newXML, 'w')
            doc.writexml(f)
            f.close()

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.