ThinkGeo.com    |     Documentation    |     Premium Support

Hide/Show features when they don't quite fit into an Overlay

I hope someone has some idea’s here.
I get the idea of placing your various features into a set of Overlays and then you simply hide/show the appropriate Overlay.

But what about when your features do not fit into an overlay? As in they fit into all or some of the overlays.

I shall do my best to explain my concept.

Lets say my features are stores that possibly sell items from three categories. Electronics, white goods and furniture.
In my app I provide the ability for the user to filter based on those three categories.
If the stores only sell items from the one category (ie. a specialist store) then easy as I have three overlays, place the features into the matching overlay and based on the filters I hide/show the appropriate overlay.

My issue is that the stores are not specialist stores and they could stock 1, 2 or all the categories.
How do I best hide/show features based on that?

The number of features I will have will range from in the tens to thousands.
The features in the app are stored in a device based repository after fetching from a web service.
The features are quite dynamic in nature in the sense that the categories they stock could change from minute to minute.

I have looked at many techniques and I think I am settling on the choice of placing all the features into a single overlay and when the filters change removing all features from overlay and load the full new set from the repo based on the filters.

I hope someone has some idea’s and can recommend a technique or at least validate my technique as possibly suitable. :slight_smile:

Regards
Chris …

Hi Chris,

Thanks for the detailed description. I’m not sure if I understand your question, correct me if I’m wrong. Maybe we could take some specific examples here, let’s say we have 3 features, Feature A(Electronics), Feature B(white goods), Feature C(furniture), so they blong to LayerOverlay Electronics, LayerOverlay White Goods, LayerOverlay Furniture respectively. If use wants to show Electronics only via filters, LayerOverlay White Goods and LayerOverlay Furniture shoud be hidden via set their IsVisible to false.

If you want to hide some specific features, you could put their ids into FeatureIdsToExclude of xxxxFeatureLayer(like InMemoryFeatureLayer, ShapeFileFeatureLayer…).

If you want to reload the data when the filters change, that’s OK if the number of features is not that large.

Thanks,
Leo

Hi @Leo_Liu,

Thanks for responding.
Unfortunately my scenario does not fit as perfectly as your example into layers I think.
Lets see if I cannot explain myself better.

My features are stores that may stock one or more of those items such as Electronics, white goods and furniture.

I provide filters to the user of Electronics, White Goods and Furniture.

The user can filter the features based on if they stock the item. E.G. show me all stores on the map that have furniture in stock. Or have furniture and white goods.

I don’t think my features (stores) can fit perfectly into a set of layers based on the items (electronics, white goods and furniture).

So my intention is to have a single layer and each time the user changes a filter I remove all features, run the query based on the filter and repopulate the layer with the features that apply to the query.

I was not aware of the FeaturesToExclude property. Good to know.

I shall be testing this myself as to what gives the best user experience of the two … but I am interested to know what your opinion and experience is towards my two techniques?

Technique 1:
Load up a single layer of features. When user changes the filters I simply remove all features, query the repo to find the subset and load the subset of features to the layer.

Technique 2:
I load all the features to the layer. When user changes the filters I discover the difference (the features not in the new set) and apply those ID’s to the FeaturesToExclude property. I assume this will hide those features on the layer?

Which one would give a better user experience do you think?

I am guessing one issue with technique 2 is it simply does not show the features set in the FeaturesToExclude property and when you query the layer you have to be aware of features in the layer that may not be shown? as they are set in the FeaturesToExclude property?
ie they are in the layer but not shown and any layer queries will still produce them.

I hope that my explanation is a little clearer this time.

Regards
Chris …

Hi Chris,

I think you made yourself clear, thanks. :smile:

Since the features are dynamic and could change from minute to minute, in my opinion, technique 1 is better. The problem with technique 2 is like what you said, that you have to care about the features which are in FeaturesToExclude when you fetch new stores according to user’s filter.

Thanks,
Leo