I have several map services published to ArcGIS Server 10.0 SP2 and I have layer metadata files exported to HTML that I want to link to the layers in the map service.
Currently the metadata HTML files are named based on the data source (eg 'Zip_Code_Poly.htm') but I need to correlate the layer name/ID from the map service to that file. I was thinking that the easiest way to do it would be to run an arcpy script to get all the layer data sources.
I've run into an issue though that the client (this is a web app) needs to look up these HTML files by service name and layer name/ID but without hard coding a mapping from service -> MXD I can't figure out what map document to use in arcpy.
Is there a way using arcpy or something else that I can look at a published map service and get the map document it was created from?
-
right click the map service document and look for the properties..Ramakrishna Billakanti– Ramakrishna Billakanti2011年12月19日 19:53:05 +00:00Commented Dec 19, 2011 at 19:53
-
Sorry, should have specified that I want to do it programmatically (through arcpy or similar).Ron Warholic– Ron Warholic2011年12月19日 19:55:46 +00:00Commented Dec 19, 2011 at 19:55
2 Answers 2
Have a look at IMapServerObjects2
You can get ArcServer map and layer properties from that.
http://resources.esri.com/help/9.3/arcgisdesktop/arcobjects/esriCarto/IMapServerObjects2.htm
-
Just a note, this is ArcObjects not arcpy. However it is possible to access ArcObjects from Python.blah238– blah2382011年12月19日 20:34:11 +00:00Commented Dec 19, 2011 at 20:34
-
Right, the question was specified as "arcpy or something else". Anyway, IMapServer3.DocumentInfo may be closer to what you need.ericoneal– ericoneal2011年12月19日 20:35:40 +00:00Commented Dec 19, 2011 at 20:35
-
Is there a specific method of
IMapServerObjects2
I should be looking for? I can't find a property of it orIMap
that would give me the map document path/filename.Ron Warholic– Ron Warholic2011年12月19日 21:08:49 +00:00Commented Dec 19, 2011 at 21:08 -
1Some would argue ArcPy is ArcObjects as all it seems to be is a wrapper around the same COM objects ;)Hairy– Hairy2011年12月20日 08:49:38 +00:00Commented Dec 20, 2011 at 8:49
-
So I looked around at the ArcObjects documentation and failed to find what I'm looking for. In essence, I need to be able to talk to a published map service (not a map document) and ask it: What document (MXD/MSD) created you? I'm pretty sure that there isn't such a beast yet but I would enjoy being proven wrong ;)Ron Warholic– Ron Warholic2011年12月22日 00:35:25 +00:00Commented Dec 22, 2011 at 0:35
I don't quite understand the question, but you can use xml.dom.minidom to read the FilePath from the map service cfg file (if you can talk to the published service from the server machine itself). Something like:
confRoot = r"C:\Program Files (x86)\ArcGIS\Server10.0\server\user\cfg\MapServiceFolder"
files = [x for x in os.listdir(confRoot) if x[-3:] == 'cfg']
for file in files:
dom = parse(file)
if dom.getElementsByTagName("FilePath")
service_name = os.path.split(file)[1].split('.')[0]
mapfile = dom.getElementsByTagName("FilePath")[0].childNodes[0].nodeValue
Dirty, but this would at least enable you to make a txt file or something on the server your web app can access. Running services have an .sts file alongside the .cfg
-
this answer using AGSSOM could help as well.geojeff– geojeff2012年02月22日 19:04:50 +00:00Commented Feb 22, 2012 at 19:04
Explore related questions
See similar questions with these tags.