ThinkGeo.com    |     Documentation    |     Premium Support

RefreshAsync doesnt load correct style

Hi Team,

RefreshAsync fails to load the correct style when the Layer has same geomety.

Could you please help here to understand why this is happening.

Thanks,
Jayshree

Hi Jayshree, can you give us some code snippet, and what do you mean by “fails to load”? it throws exceptions or just returns blank map?

Hi Ben,

I’m working with features (see screenshot below).

When a feature is clicked, we apply some custom styles to the selected feature. However, if there are duplicate features in the feature list, the correct style is not applied to the selected feature when we call RefreshAsync() .

We suspect this is because the result is coming from the overlay cache.

Here is the code snippet:

    new ValueStyle(nameof(HighlightStop.IsSelected), new()
    {
        new ValueItem("0", _geoStyleService.GetThinkGeoLabelStyle(GetPointStyle())),
        new ValueItem("1", _geoStyleService.GetThinkGeoLabelStyle(GetSelectedPointStyle())),
    })
);

// For point
_featureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(
    new ValueStyle(nameof(HighlightStop.IsSelected), new()
    {
        new ValueItem("0", (ThinkGeo.Core.PointStyle)_geoStyleService.GetThinkGeoStyle(GetPointStyle())),
        new ValueItem("1", (ThinkGeo.Core.PointStyle)_geoStyleService.GetThinkGeoStyle(GetSelectedPointStyle())),
    })
);

_featureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

return _featureLayer;

Could you please advise whether the overlay cache might be causing this issue, or if there’s a better way to ensure the correct style is applied when dealing with duplicate features?

Thanks,
Jayshree