ThinkGeo.com    |     Documentation    |     Premium Support

Display features of an inmemory layer according to a value

Hi,

Our problem is as follows.
We have an inmemoryfeaturelayer layer and the features displayed have a different color code according to a specific value (1 = red; 0 = Yellow, etc …)
The user will check what features they want to see on this layer. It can be all features or some features that have a value of 1 (for example)
There is FeatureIdsExclude which allows you to do that.
Is there another approach to do this. (by style or other …)
If yes, which is faster?

Thanks a lot for your help.
Regards.

Steph.

Thanks Steph,
The quick way to do this. You could group the features to different inmemoryfeaturelayer. And give the inmemoryfeaturelayer a good name such as “red”, “yellow”. Then you can call something like this to hide/display the layer.

((LayerOverlay)mapView.Overlays["InmemoryOverlay"]).Layers["red"].IsVisible = false or true;
 mapView.Refresh();

Thanks

Frank

Hi,

Thanks for your response.
I think that your solution is not too adequate in relation to our problem
The displayed values ​​(these are lines) are dyamic (1 = red, 0, Yellow, etc …)
Depending on dates entered by the user, the number of lines that appear differ.
So creating or deleting a layer at each change of dates, this seems to me an approach that can bring slowness.
I think you have to stay on a single layer that displays all the data
If the user wants to display certain data or not, then (that’s where my question is), use FeaturesIdsExclude or using style or other …

But thank you very much for your help.

Regards.

Thanks Steph,
Yes. If all features in the same layer both FeatureIdsToExclude and ValueStyle could implement your requirement.

I recommend use FeatureIdsToExclude. Here is the code to hide the feature by using FeatureIdsToExclude.
((InMemoryFeatureLayer)((LayerOverlay)mapView.Overlays["InmemoryOverlay"]).Layers["InMemoryFeatureLayer"]).FeatureSource.FeatureIdsToExclude.Add("The ids you want to hide");

Because this is inmemory Overlay the performance should not be a problem.

Thanks

Frank