Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am new to ArcGIS Server. I have a Python script tool that I've published as a geoprocessing service.

The script takes a point feature class, writes a subset of the input FC as a new FC in the scratchworkspace, creates some new fields and calculates values for these fields based on user input parameters.

The service and all of the calculations the script is performing, works fine - I can go into the scratch workspace on the server, find the unique job ID folders, and see my results.

Eventually, I want to consume it via the Flex API, but for now, I am trying to get it working by consuming it in ArcMap Desktop.

My problem is getting these results loaded into the map. I've followed the advice given in response to this question. I've added an output parameter, tried to load the results as a FeatureSet and set the output parameter to be the FeatureSet.

When I do this using the following code, I get an error that I "cannot load table into a FeatureSet". This doesn't add up because my output is a point feature class (I have confirmed this by looking at it in the scratchworkspace on the server).

result = "%scratchworkspace%\Scratch.gdb\output"
res = "in_memory/result"
r = arcpy.CreateObject("FeatureSet")
r.load(res)
arcpy.SetParameter(9, r)

Any advice or direction would be appreciated. Thanks, -Erik

share|improve this question
    
Does the result show up properly in the "Geoprocessing Results" tab? –  om_henners Jan 24 '12 at 22:01
add comment

2 Answers 2

up vote 3 down vote accepted

It looks like you're trying to reference the "result" variable with this line:

res = "in_memory/result"

but this just assigns a string to res, it doesn't assign the 'result' variable. You don't need the "res" variable at all. Get rid of it and instead of this:

r.load(res)

Call this:

r.load(result)
share|improve this answer
    
Excellent! This did the trick... thank you much for the code snippet and helpful explanation! –  emart88 Jan 25 '12 at 13:10
add comment

What I think you need to do, is to copy each feature line by line. I am away from my development machine currently, but as I remember it, you need to make a selection of your data, loop through the selection and add it to a new feature, adding the data after each row. I just remember having issues doing a straight copy.

I am away on business until Friday, but will post code then, which does, pretty much, precisely what you need doing, save from adding an output param, as we didn't need to do that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.