Create Random Points - Geoprocessing Service

1722
8
06-02-2010 06:19 AM
DavidChevrier
Occasional Contributor II
I posted this yesterday in the ArcServer general forum, but added a few silverlight specific questions to it.

Hi,
I'm having a tough time creating a simple geoprocessing service that only uses the "Create Random Points" tool. What do I use for my "output location"? I tried to follow the buffer point example in the documentation, but it won't let me use %scratchworkspace%. My best theory is that the buffer point example asks for one field as the output that includes the location and filename, however the create random points tool separates out the "output location" and the "output point feature class".

I'm looking to create a service that is executed when a user presses a button that then creates a bunch of points contained in a predefined area (a shapefile stored on the server) and displays them on my map. I'm using C# and the Silverlight api if that helps.


Once I do create the points, how can I dynamically add them to my map using the silverlight api?  Do I just have to make a graphic layer and retrieve the XYs from the newly created data to populate the layer?  Is there any way to dynamically add data located on the server itself?

Thanks,
-dave
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor
The "Create Random Point" gives you a feature class as output.
You have only to declare this output feature class as model parameter (when editing the model, right click on the output, verify that 'Model Parameter' is checked).

Behind the scene, the geoprocessing framework will convert the output feature class to a feature set which can be returned by a GP service.

After publishing your GP service, you have to execute it in from the silverlight API (there are some samples with the interactive SDK).
The result of the execution of your GP service will give you a GPFeatureRecordSetLayer object containing all the features.
Then you can include these features into a graphic layer.
0 Kudos
DavidChevrier
Occasional Contributor II
Thanks for the help, but something still doesn't seem right (also, I'm using 9.3.1 sp 1, so I don't know if something has changed in 10).  Have you tried to make a model with just that tool, set relative paths, and make the "output feature" a model parameter (along with the "constraining extent" and "number of points")?  While it does load into arcserver, I'm running into problems executing it.  (Even when using the submit job in http://<SERVER_NAME>/ArcGIS/rest/services/CreateRandomTool/GPServer/Create%20Random%20Points/submitJob page)

The "output feature" does not show up on that page at all.  It does shows up on the meta page about the service, but not under the submit job page.  Again, I think this is due to the input requirements of the tool itself.  You can't change any property about the "output feature" in model builder (the data type or name).  You can only change the "output location" and "output point feature class" which are required inputs.  If anyone has able to set this up, could you let me know?  Or maybe I am just calling it wrong.

Any other ideas??  Please, I really need to use this tool in server.
Thanks,
-dave
0 Kudos
DominiqueBroux
Esri Frequent Contributor
From the rest endpoint you are mentioning, I guess you are using an asynchronous GP server.
So it's normal that the output parameters don't show up in http://<SERVER_NAME>/ArcGIS/rest/services/CreateRandomTool/GPServer/Create%20Random%20Points/submitJob page.
With this page you should only see the status of your job : Submitted, Executed, Succeeded :cool: (or failed 😞 ).
To get the result you have to execute another request on the result.

What is the status of your Job?
If it's 'failed' it means that the problem is with your GP service and not with your Silverlight code.

If it's 'Succeeded', it means that the problem is in your code. Take care that the the method to submit the request is depending on the type of task (synchronous, asynchronous). If your service is asynchronous, you should use 'SubmitJobAsync' (and not 'ExecuteAsync' despite the name :)).
0 Kudos
DavidChevrier
Occasional Contributor II
ahhh... thanks for the info, I didn't realize the output parameters aren't viewable there.  You are correct that it is an asynchronous GP server.  When I turn on messages, I get the following when I execute the code now:

    * esriJobMessageTypeInformative: Submitted.
    * esriJobMessageTypeInformative: Executing...
    * esriJobMessageTypeError: ERROR 000824: The tool is not licensed.
    * esriJobMessageTypeError: Failed.


So I guess my license level doesn't allow for the create random points tool.  Which is weird because the tool documentation says that it works with ArcView if you have either the 3D or spatial analyst extensions.  And according to:
http://webhelp.esri.com/arcgisdesktop/9.3/pdf/Geoprocessing_Quick_Guide.pdf
it is an ArcView level tool.  According to my authorization summary, my server is licensed for the following:
ArcGIS Server
ArcGIS Server 3D
ArcGIS Server Enterprise Edition
ArcGIS Server Standard Edition
ArcSDE

So is this tool not licensed by the ArcGIS Server Standard Enterprise Edition?  I really don't want to upgrade just for one tool.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
For sure you don't need to upgrade your server licese. The 'CreateRandomPoint' tool is at the lowest level of needed license.

Either you have a gloabl server licensing issue (but you should have the same issue whatever the GP tool) or it's a specific issue with your model but I don't see which one (are there other tools in your toolbox which could need server extensions? are you using a script or a model?).

I am afraid, I am not able to help you more on this license issue. Try posting the question to geoprocessing or server forum.
0 Kudos
DavidChevrier
Occasional Contributor II
Again, thanks for the help.  I am able to create and use the BufferService from the samples, so I don't think its a global issue.  The service I'm having problems with is just a single toolbox with a single model in it.  The model only has one tool (and that being the create random points).  

So I'm not convinced that the error message being reported to me is correct, but I have no idea what else it could be.  At least I've got the tool to load into ArcServer now (although I can't use it...).  My EDN subscription recently ran out, but will be renewed soon.  I'll try a higher license to see if that solves it, but hope to figure something out before then...
0 Kudos
DavidChevrier
Occasional Contributor II
Well, it turns out it IS a licensing issue...  even though the "Create Random Points" is an ArcView level tool, it relies on the "Feature to Point" tool which is an ArcInfo level tool.   (Had to really search the forums for that info....)  I'm not very happy about this, especially now that I have a working model that works fine in ArcView level ArcMap, but not on the server.  (Due to my spatial and 3d analyst extensions.)

FYI - to get the tool to work, I had to set the "Output Location" to "in_memory" then add the "Copy Features" tool to save it to the %scratchworkspace%.  It was due to the C.R.P. tool's parameters of Output Location and Name being separate rather than a single variable.

Thanks,
-dave
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Great:)
I am very glad you eventually get the tool to work.
Note that I don't think it's useful to chain with the 'Copy Feature' tool. You could directly give the real name instead of in_memory and declare the output of the random tool as parameter. But that's not very important.
0 Kudos