Geoprocessing Clip

3445
8
Jump to solution
06-10-2013 02:46 AM
Labels (1)
FedorNovikov
New Contributor II
Hello!

I try to make my first Geoprocessing project on WPF. I need to aplly Clip tool to layers, so I tryed to make it like in WPF Examples (WPFSampleApplication10.1.1). I've made the same application in Visual Studio 2012 and all works fine. But when I try to do my own .gpk file there were some problems. All i do this: 1. Same toolbox 2. Run it 3. Make gpk 4. Export and try to run it.
then i parse
_gpTask.ExecuteCompleted -> e.Results.Messages
to Xml file. May be it would be helpful.
<?xml version="1.0" encoding="utf-8"?> <Log>   <date_10.06.2013_14_33_06 Name="Executing (ClipFeatures): ClipFeatures &quot;100 Kilometers&quot; &quot;Feature Set&quot;" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:03 2013" Error="" />   <date_10.06.2013_14_33_06 Name="Executing (ClipFeatures): ClipFeatures &quot;100 Kilometers&quot; &quot;Feature Set&quot;" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:03 2013" Error="" />   <date_10.06.2013_14_33_06 Name="Executing (ClipFeatures): ClipFeatures &quot;100 Kilometers&quot; &quot;Feature Set&quot;" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:04 2013" Error="" />   <date_10.06.2013_14_33_06 Name="Executing (Buffer): Buffer &quot;Feature Set&quot; C:\Users\1\AppData\Local\Temp\arcgisruntime_6260\clipfeatures\jobs\_\j093970f38300414a902fc9e7f4dc18e0\scratch\scratch.gdb\Polyline_Buffer &quot;100 Kilometers&quot; FULL ROUND NONE #" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:04 2013" Error="" />   <date_10.06.2013_14_33_06 Name="WARNING 000117: Warning empty output generated." Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:04 2013 (Elapsed Time: 0,00 seconds)" Error="" />   <date_10.06.2013_14_33_06 Name="Executing (Clip): Clip ClipFeatures\Counties C:\Users\1\AppData\Local\Temp\arcgisruntime_6260\clipfeatures\jobs\_\j093970f38300414a902fc9e7f4dc18e0\scratch\scratch.gdb\Polyline_Buffer C:\Users\1\AppData\Local\Temp\arcgisruntime_6260\clipfeatures\jobs\_\j093970f38300414a902fc9e7f4dc18e0\scratch\scratch.gdb\Polyline_Buffer_Clip #" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:04 2013" Error="" />   <date_10.06.2013_14_33_06 Name="WARNING 000117: Warning empty output generated." Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:05 2013 (Elapsed Time: 1,00 seconds)" Error="" />   <date_10.06.2013_14_33_06 Name="Executing (Select Data): SelectData C:\Users\1\AppData\Local\Temp\arcgisruntime_6260\clipfeatures\jobs\_\j093970f38300414a902fc9e7f4dc18e0\scratch\scratch.gdb\Polyline_Buffer_Clip #" Error="" />   <date_10.06.2013_14_33_06 Name="Start Time: Mon Jun 10 14:31:05 2013" Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:05 2013 (Elapsed Time: 0,00 seconds)" Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:05 2013 (Elapsed Time: 1,00 seconds)" Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:05 2013 (Elapsed Time: 2,00 seconds)" Error="" />   <date_10.06.2013_14_33_06 Name="Succeeded at Mon Jun 10 14:31:05 2013 (Elapsed Time: 2,00 seconds)" Error="" /> </Log>


I can't find any mistakes. I think something wrong with making GPK.
Any ideas or links?
0 Kudos
1 Solution

Accepted Solutions
KevinHibma
Esri Regular Contributor
When you created the GPK from the Result - it sounds like you passed layers from the ToC into the model?
If thats the case, when you turned the Result into the GPK, it will always expect layers.
You'll need to modify your original model. Within Modelbuilder you can turn the input parameters from Feature Layers into a Feature Set. FeatureSet takes layers and, well features, just like it sounds (and like you're trying to do). After you've switched your model, run it, re-create the GPK and try that.

As Mike pointed out, load your GPK into the GPTaskInfo. It'll show you the "DataType" for each input which should look like "GPFeatureRecordSetLayer" (not something with a "Choice List")

View solution in original post

0 Kudos
8 Replies
FedorNovikov
New Contributor II
Now I have a new Error when  _gpTask.Failed:
Error executing tool.: ERROR 000800: The value is not a member of Polyline_Buffer_Clip | FirstLayer | SecondLayer.
The value does not exist.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Try running the GPTaskInfo sample in the Sample App - browse for your GPK and check that the parameter names are the same as you're calling in code.

Cheers

Mike
0 Kudos
FedorNovikov
New Contributor II
Thank you very much! Your advice was very useful.
I have found a mistake and now its work good.
0 Kudos
FedorNovikov
New Contributor II
Now, I try to do more smart thing. Clip two layers which doesnt exist when I make GPK, but then I use programme on C# with two FeatureSets and try to clip them.
What I do:
1. Make two empty Layers in ArcMap
2. Clip them by my custom geoprocessing  tool
3. Export results with parameters
4. Use this gpk in code:
 parameters.Add(new GPFeatureRecordSetLayer("Input", CountiesFeatures));
something like that
5. Execute gpTask
6. when Execute completed I've got empty result!

So I try to do it this thing in ArcMap. Use same my custom geoprocessing tool, but layers was with data, all ok (another data then in FeatureSet). Export gpk. Then in code use this gpk and what I see? ArcGis ignore my FeatureSet and instead that use data from layers that I used in ArcMap.

What can I do with that?
0 Kudos
KevinHibma
Esri Regular Contributor
When you created the GPK from the Result - it sounds like you passed layers from the ToC into the model?
If thats the case, when you turned the Result into the GPK, it will always expect layers.
You'll need to modify your original model. Within Modelbuilder you can turn the input parameters from Feature Layers into a Feature Set. FeatureSet takes layers and, well features, just like it sounds (and like you're trying to do). After you've switched your model, run it, re-create the GPK and try that.

As Mike pointed out, load your GPK into the GPTaskInfo. It'll show you the "DataType" for each input which should look like "GPFeatureRecordSetLayer" (not something with a "Choice List")
0 Kudos
FedorNovikov
New Contributor II
Feature Set is good! And works fine and fast! Thanks khibma!
I did all this geoprocessing things.

But one more problem occurs, when I copy GPK to another project, this now not working and give me an error, when I try to get service
LocalGeoprocessingService.GetServiceAsync:
Failed to create service clipfeature GPServer. Worker process 'clipfeature_host' exited while attempting to service request (attempt 1 of 1): 
endpoint='admin' headers={} params={filePath=f:\documents\visual studio 2012\projects\geoprocessing\geoprocessing\gpk\clipfeature.gpk, jobDir=C:\Users\1\AppData\Local\Temp\arcgisruntime_5052\clipfeature\jobs, maxRecords=1000, name=clipfeature, 
outputDir=C:\Users\1\AppData\Local\Temp\arcgisruntime_5052\clipfeature, type=GPServer, virtualDir=http://127.0.0.1:50000/ph8z9n/outputdir/clipfeature} res='create' post=0 
Crash dump path=C:\Users\1\AppData\Local\Temp\ArcGISRuntimeErrorReports\arcgisruntime_10.1.1.3298_service_20130614_145854.dmp Error code: 500
0 Kudos
FedorNovikov
New Contributor II
Ok. I have done it. I need only make right license Runtime file with geoprocessing.
0 Kudos
KevinHibma
Esri Regular Contributor
Great news.

Just an FYI, with the upcoming release of Desktop 10.2 we've modified how you create a GPK for Runtime. You'll have the ability to better control input parameters when creating the GPK. (This will be similar to the GP Server experience).
0 Kudos