POST
|
I have found my solution. In trying to understand this I got my memory mixed up and was looking at the xml of SD files and not the sddraft file created by ArcMap. Using a comparison tool I made a default MapServer service sddraft and one with the FeatureServer/Full Access capability turned on and the KmlServer turned off. It's actually very simple yet there is no examples or instructions on how to do it anywhere. ESRI's code is totally backwards in my opinion. Sparing everyone why it is wrong this is my code as pertaining to the xml editing part: import arcpy import xml.dom.minidom as DOM arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER', con, False, None, summary, tags) doc = DOM.parse(sddraft) typeNames = doc.getElementsByTagName('TypeName') for typeName in typeNames: if typeName.firstChild.data == 'FeatureServer': extention = typeName.parentNode for extElement in extention.childNodes: if extElement.tagName == 'Enabled': extElement.firstChild.data = 'true' if typeName.firstChild.data == 'KmlServer': extention = typeName.parentNode for extElement in extention.childNodes: if extElement.tagName == 'Enabled': extElement.firstChild.data = 'false' f = open(sddraft, 'w') doc.writexml( f ) f.close() Essentially all you have to do is change those 2 'Enabled' values. The sddraft in xml format is completely backwards which is what was messing me up. Each SVCExtension heading states no name and then proceeds to say whether it's enabled, then all of its properties and finally it's name. Every time I try to tackle a ESRI coding issue I am unable to find relevant code, once I do find it I am unable to piece together anything relevant due to incorrect documentation and that's if the code isn't broken. The documentation is devoid of links to relevant datatypes (if they are even correct). I digress, and on I drudge...
... View more
08-20-2014
09:13 AM
|
0
|
0
|
362
|
POST
|
I am using ArcGIS Server 10.2 and am able to successfully use arcpy to publish MapServer and GeoCode services. However, I cannot find anything about publishing a FeatureServer service outside of initially publishing it as a MapServer service and then modifying it. I have mxd's and they mostly get published as MapServer services using the general: arcpy.mapping.CreateMapSDDraft > StageService_server > UploadServiceDefinition_server commands. I want to be able to publish from mxd to FeatureServer service in much the same way as above. This seems like it was possible with the legacy msd files(old sd format). Like much else with ESRI I am perplexed at the lack of intuitive/complete documentation and features. I have tried many ways of manipulating the sddraft file with xml.dom.minidom but to no avail. The analyze and stage commands say the draft is ok but then it throws a 001270 error. I have looked this error up and much of the solutions seem very inapplicable to my situation. I have tried pretty much everything I can find web searching for a solution so if anyone has any other knowledge it is much appreciated.
... View more
08-19-2014
02:26 PM
|
1
|
2
|
1081
|
POST
|
Thanks for the information, even if it's a bummer for me I guess i'll have to work around it. Thanks. Could you put this in as an idea for future versions of arcpy? Thanks
... View more
07-09-2014
11:02 AM
|
0
|
5
|
1516
|
POST
|
Hi Duncan, Thanks for the reply. This script looks like it only sets the initial extent and not the full extent. Great code though. To be clear, the 'intial extent' of a map document is the dataframes extent property which I am aware of how to use. I need the elusive 'full extent'.
... View more
07-09-2014
09:56 AM
|
0
|
1
|
1516
|
POST
|
I am using arcpy for 10.2 and am able to set the initial extent of the map using the dataframe's extent property. This is the initial extent that the map comes up at when the MXD is loaded. How do I set the full extent programmatically using arcpy? This article describes how to do it in ArcGIS Desktop 10.2: ArcGIS Help (10.2, 10.2.1, and 10.2.2) Also, the full extent shows up right next to the initial extent in ArcGIS Server when an mxd is published as a service. It feels like the setting is so close yet I have spent far too much time trying to decipher ESRI help articles to figure this out. To be clear again: Initial Extent: initial zoomed area when an mxd is opened up and a map documents dataframes extent value: Example: df = arcpy.mapping.ListDataFrames(mxd)[0] newExtent = df.extent Full Extent: area that is zoomed to by clicking the Full Extent(globe icon) button in ArcGIS Desktop 10. Thanks for any help.
... View more
07-09-2014
06:26 AM
|
0
|
10
|
9183
|
Title | Kudos | Posted |
---|---|---|
1 | 08-19-2014 02:26 PM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|