Question for the Python folks.
I'm trying to add a feature class from my scratch .gdb and have been successful using arcpy.mapping.addLayer. I'm adding the feature class to the mxd which is set to the following:
mxd = arcpy.mapping.MapDocument("current")
The problem is I'm trying to publish a script tool to a web service, and I know I cannot use "CURRENT" so instead I use the file path of my MXD. While the script tool works, creates my feature class in the scratch .gdb, it does not automatically add the feature class to my TOC as the above line of code does.
Here's what I'm changing it to instead:
mxd = arcpy.mapping.MapDocument("C:\\users\\testUser\\desktop\\testMap.mxd")
The only difference in the entire script is where I'm changing the MXD path. Am I doing this wrong? Any suggestions or recommendations?
Solved! Go to Solution.
So I ended up creating four feature classes, then merging them into one feature class at the end per your suggestion.
Additionally, I had to add a field and calculate the field to make each of the records in each of the feature classes unique, but anyways I got a desired web service to do what I needed it to do. The service now accepts anywhere from 1-4 parameters and always has 1 output which is symbolized by a layer file. Thanks for giving me another approach to solve this, Kevin.
Thanks to everybody else who chimed in as well. All of this is great!