DynamicLayerInfos and GenerateRendererTask renderer legend

2994
10
Jump to solution
10-24-2014 01:26 AM
LaurentSIBILLE
New Contributor

Hi,

We are trying to add thematic analysis by using following items:

- DynamicLayerInfos.

- QueryTableDataSource with custom SQL query targeting a custom WorkspaceID (SQL Server).

- GenerateRendererTask with UniqueValueDefinition classification.

Previously with the SDK for WPF we were able to change the UniqueValueRenderer infos label generated by the renderer task.

This was necessary because using UniqueValueDefinition, there was no way to define which associated label to use within the legend control.

With the SDK for .Net, our previous code no longer works.

If we change a property on the renderer generated by the GenerateRendererTask, the dynamic layer is no longer displayed on the map.

We don't know if we are doing thematic analysis the right way but we would like to add some functionality found within ArcMap 10.2.2 to our WPF application.

Any help will be very appreciate.

Thanks

0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor

Hi Laurent,

It looks like you found out a bug on how an UniqueValueRenderer is rehydrated after a property changed.

The workaround may be to get the 'Fields' and 'DefaultSymbol' before changing any renderer property.

With your sample:

var typedUniqRender = (result.Renderer as UniqueValueRenderer);

if (typedUniqRender != null)

{

    // Workaround to BUG: call once the Fields and DefaultSymbol getters before changing the renderer.

    var fields = typedUniqRender.Fields;

    var symbol = typedUniqRender.DefaultSymbol;

    foreach (var info in typedUniqRender.Infos)

        info.Label = "***" + info.Label; // If we customize the label here, there is bug that don't render the map anymore

}

Thanks for reporting this issue, we'll try to get it fixed in the next version.

/Dominique

View solution in original post

10 Replies
dotMorten_esri
Esri Frequent Contributor

Here's a sample that uses the generate renderer task on the dynamic map service: arcgis-runtime-samples-dotnet/DynamicLayerRendering.xaml.cs at dda4952b26386455a0f1cfc4e3d21d05d7ad7...

0 Kudos
LaurentSIBILLE
New Contributor

Hi Morten,

Thanks for your quick answer.

We have already seen this sample and we are using the generate renderer task according to this sample.

As said before, we would like to add some functionality found within ArcMap 10.2.2 regarding thematic analysis.

Is there a way to change the renderer result's infos to let the Legend control displayed relevant informations?

Is there a place to submit issues as we can do for 'arcgis-toolkit-dotnet' (github)?

Thanks again for your help.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Are you able to post the code which currently works against the WPF SDK and the code you are trying to run against the .NET SDK?

If necessary you could switch it to use a public sample service such as Census (MapServer)

Cheers

Mike

0 Kudos
LaurentSIBILLE
New Contributor

Hi,

I attached a modified version of toolkit samples for .net.

Open solution : samples\ArcGISRuntime.Toolkit.Samples.sln

Run it in debug mode or release mode

Go to : Toolkit/Legend/Legends (from Renderer Task Result)

If you click on 'Generate Unique Values' button, the map is no longer rendered.

But if you click on 'Generate Range Values' button, the map is rendered and label's legend was modified to:

***[Label value]

Within LegendsFromRendererTask.xaml.cs file, I added the following comment to let you what we are trying to do regarding this issue:

//  BUG ?

I didn't have time to prepare a working sample using the SDK for WPF but if you really need it to track this issue I will try to do it.

The code is quite the same for both SDKs.

To sum-up changing labels on ClassBreaksRenderer works fine but it doesn't works for the UniqueValueRenderer

Thanks for your help.

Cheers,

David

0 Kudos
DominiqueBroux
Esri Frequent Contributor

Hi Laurent,

It looks like you found out a bug on how an UniqueValueRenderer is rehydrated after a property changed.

The workaround may be to get the 'Fields' and 'DefaultSymbol' before changing any renderer property.

With your sample:

var typedUniqRender = (result.Renderer as UniqueValueRenderer);

if (typedUniqRender != null)

{

    // Workaround to BUG: call once the Fields and DefaultSymbol getters before changing the renderer.

    var fields = typedUniqRender.Fields;

    var symbol = typedUniqRender.DefaultSymbol;

    foreach (var info in typedUniqRender.Infos)

        info.Label = "***" + info.Label; // If we customize the label here, there is bug that don't render the map anymore

}

Thanks for reporting this issue, we'll try to get it fixed in the next version.

/Dominique

View solution in original post

LaurentSIBILLE
New Contributor

Hi Dominique,

Thanks for the workaround.

We hope you will be able to fix it for next release.

It will be great to be able to reproduce some ArcMap functionalities regarding thematic(statistical) analysis using the SDK for .Net (or through the toolkit for .Net):

http://resources.arcgis.com/en/help/main/10.2/index.html#/Statistical_analysis/018p00000006000000/

http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Statistics_With_Map_Online/02q20...

Any advice regarding how to create thematic(statistical) analysis (with a legend that contains for each item a custom label and the number of objectids associated with it) will be very appreciate.

Thanks,

P.S: sorry for my english we are french users of the SDK for .Net

0 Kudos
DominiqueBroux
Esri Frequent Contributor

Statistical analysis can be executed through the geoprocessing Tools (samples of how to execute geoprocessing tools with the SDK for .Net).

For displaying the result, it's a matter of renderer which can be created using a GenerateRenderer task (as in the sample you pointed out) or directly by using the .Net API.

Then the legend will be automatically based on the renderer properties.

Edit: Updated the link to the .Net sample instead of the WPF sample.

LaurentSIBILLE
New Contributor

Thanks for your advice.

We will give it a try.

As you pointed us to a sample from SDK for WPF, it seems that theses samples should be easily translated to the SDK for .Net.

/Citegestion

0 Kudos
DominiqueBroux
Esri Frequent Contributor

I updated my answer to point to the .Net sample.

0 Kudos