the sample code for Geoprocessing extract data cannot select layer

2545
1
11-05-2015 12:25 AM
faot
by
New Contributor

Hi,

i download the sample code for Geoprocessing extract data

when i run it i cannot select layer for extraction, the layers list are empty.

Capture.PNG

0 Kudos
1 Reply
FreddieGibson
Occasional Contributor III

It looks like there is a problem with the service. If you navigate to the REST endpoint for the Extract Data Task (HomelandSecurity/Incident_Data_Extraction) service you'll see that the ChoiceList is missing. As a result this is causing the logic on line 48 in the sample to return an empty string from the "Layers_to_Clip" parameter.

The code in .NET is working properly because the ListBox in the second steps displays properly and it leverages the same logic as the first step. I'd have to ask around to see if if someone can look into this from the server side. Until this is fixed you could supply the names of the layers for the parameter within the code or you could leverage one of your services.

// Sets up UI choices from the extract data service information
private async void SetupUI()
{
    try
    {
        var info = await _gpTask.GetTaskInfoAsync();


        listLayers.ItemsSource = info.Parameters.First(p => p.Name == "Layers_to_Clip").ChoiceList;


        comboFormat.ItemsSource = info.Parameters.First(p => p.Name == "Feature_Format").ChoiceList;
        if (comboFormat.ItemsSource != null && comboFormat.Items.Count > 0)
            comboFormat.SelectedIndex = 0;
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message, "Sample Error");
    }
}