ThinkGeo.com    |     Documentation    |     Premium Support

Filterstyle/-condition issue

Hello,

I’m experiencing a very strange issue with FilterStyles and FilterConditions . I’ve created an MP4 video to demonstrate it, as it’s quite difficult to explain in words.

In short: when displaying an overlay using filters, it sometimes randomly shows features that do not match the filter conditions , but only at the currently active zoom level . It’s not always a specific zoom level that’s affected. When I change the zoom level, the map renders correctly again. Occasionally, zooming in and out causes the previously corrupted zoom level to suddenly display correctly.

Here’s how I define multiple filter conditions:

            Dim AangebrachtGietMortel As New FilterStyle()
            AangebrachtGietMortel.Conditions.Add(New FilterCondition("gietmortel", "ja"))
            HatchStyle = New GeoHatchBrush(GeoHatchStyle.ForwardDiagonal,GeoColor.FromArgb(250, GeoColors.DarkBlue), GeoColor.FromArgb(0, GeoColors.BrightOrange))
            Areastyle = New AreaStyle(New GeoPen(GeoColors.Black, 1), HatchStyle)
            AangebrachtGietMortel.Styles.Add(Areastyle)
            AangebrachtGietMortel.Styles.Add(New TextStyle("Tekstlabel", New GeoFont("Segoe UI", 3.5, DrawingFontStyles.Regular), GeoBrushes.DarkBlue))
            listOfStyles.Add(AangebrachtGietMortel)

And then set the zoomlevels like this:

        lay.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(SimpelStyle)
        lay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level14

        For Each stijl As FilterStyle In FilterStyles
            lay.ZoomLevelSet.ZoomLevel15.CustomStyles.Add(stijl)
        Next
        ' Zoomlevel 15 t/m 20
        lay.ZoomLevelSet.ZoomLevel15.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20

In the video, the one remaining feature is actually correct — it’s the others that appear unexpectedly.

Am I missing something?

Best regards,
Guido van den Boom

Hi Guido,

It gives me “the page cannot be found” after I hit the download button, can you reupload it?
Also, which version you are on right now?

Thanks,
Ben

Hi Ben,

Does this version work? I was on beta027, I use beta032 right now.

Regards,
Guido

no, still not working even after I logged in.

Strange… I can download it right away!
I will try something else…

Does this link work?
https://mega.nz/file/VvklnSbB#DmYpwPSVnSkekShw5CVJYlHNurFs39yMldBLBUPQOyo

The video works. working on it.

Guido,

I feel it’s a caching issue. Can you do

overlay.TileViewInMemoryCache = new XyzLruCache(0);

to your code, and let me know if it gets better?

Thanks,
Ben

Ben,

That didn’t fix the issue with creating phantom features on the active zoom level. After zooming in and out one step and returning to the starting zoom level, the phantom features are no longer visible.

Each time I click the Update Status button, the overlay is completely disposed and removed from the overlays. The overlays are also only in memory with no tile cache, so it can’t be a caching issue.

Additionally, there are features visible that don’t meet any of the specified filters.

In the picture below, the features in the green square are correct, but the features in the red square should not be there. It also looks like the problem is in one tile only, because the rightmost feature is cut off even though it was in the middle of the screen.

After zooming in and out, or panning those features off the screen, these features are no longer visible.

Then I click the Update Status button again and get this result: completely random other features are visible with the wrong colors and hatches.

For now I think I found a workaround: I just added an extra RefreshAsync. I can see the phantom features appear and then disappear because of the second RefreshAsync.

    Await mapView2.RefreshAsync(OVL)
    Await mapView2.RefreshAsync(OVL)

The problem for me is now that colleagues are using printscreens in their status reports for over 4.000 objects. I just hope that the features that remain visible after 2x refreshasync are correct.

Hope you find out the reason behind this and make sure the filters are working reliable.

Regards,
Guido van den Boom

Hi Guido,

Let’s try to get to the bottom of it, can you

  1. Set the Overlay.TileType to SingleTile to make it easier to debug.
  2. Create a custom FilterCondition:
class MyFilterCondition : FilterCondition
{
    public MyFilterCondition(string columnName, string expression)
        : base(columnName, expression)
    {
    }

    protected override Collection<Feature> GetMatchingFeaturesCore(IEnumerable<Feature> features)
    {
        var result = base.GetMatchingFeaturesCore(features);
        return result;
    }
}

and use this condition in your code;

    Preformatted text`AangebrachtGietMortel.Conditions.Add(New MyFilterCondition ("gietmortel", "ja"))

check out the result it returns and see if it is as expected.

Or if you can set up a small demo and send it to us, we can figure it out on our side.

Thanks,
Ben

Hi Ben,

It is still not working. It took me a while to understand what to do to find the problem.
I think it is in GetMatchingFeaturesCore.

This is the query on the database, 15 results:
image

This is my GetMatchingFeaturesCore now. I added manual check for gietmortel = ‘ja’
on the result by GetMatchinFeaturesCore.
I started the ‘Status update’ 3 times. result collection had different numbers of features (1st 55 results, 2nd 41 results, 3rd 49 results).
The manual check of the result collection tmpColl had 15 results each time.
So 15 features of result truly had gietmortel=ja.

    Protected Overrides Function GetMatchingFeaturesCore(features As IEnumerable(Of Feature)) As Collection(Of Feature)
        Dim result = MyBase.GetMatchingFeaturesCore(features)

       'Manually check for true gietmortel = ja results
        Dim tmpValue As String = String.Empty
        Dim tmpColl As New Collection(Of Feature)
        For Each feat As Feature In features
            feat.ColumnValues.TryGetValue("gietmortel", tmpValue)
            If tmpValue.ToLower = "ja" Then
                tmpColl.Add(feat)
            End If
        Next
        Return result
    End Function

The rest had no result, but ended up in the collection somehow. As you can see in the picture gietmortel has no value.

Hope this is enough information for you to find the bug.

Regards,
Guido van den Boom

Hi Guido,

It could because of the multicolumn check. Can you serialize the features to json, save it to a txt file and send over to me?

protected virtual Collection<Feature> GetMatchingFeaturesCore(IEnumerable<Feature> features)
{
  var geoJson = features.GetGeoJson();
}

Thanks,
Ben

1 Like

Hi Ben,

Here are two files. The zip file contains all the features from which the GetMatchingFeaturesCore should select the 15 rows with gietmortel = ‘ja’ (yes in Dutch) and objectType = ‘triax_fundexpaal’
The features_result.txt contains the result for a try. This file is different every time the GetMatchingFeaturesCode is executed.

features_base.zip (1.7 MB) features_result.txt (207.5 KB)

Thanks,
Guido

Hi Guido,

Thanks for the test data! The issue is verified and fixed in the latest beta, please pull the latest 14.4.0-beta038 and have another try.

Thanks,
Ben

Hi Ben,

I can confirm I get the result I expect. No more random hatches.

But the user experience with panning is terrible with this version. Are you working on that?

At the end of the panning (holding left mouse button) a mouse click seems to be triggered, so it keeps selecting features after panning.
When drawing a line in TrackOverlay it adds a point and create a vertex by itself.

Thanks,
Guido

Hi Guido,

It’s a bug introduced in the recent versions. It’s fixed in beta039, please pull and have another try.

Thanks,
Ben

Hi Ben,

The bug still exists in beta039 exactly the same as it was.

Regards,
Guido

Hi Guido,

It seems in beta039, we only fixed the issue where the MouseClick is raised after a DoubleClick, but didn’t fix the issue where MouseClick is raised after panning. Now it is all be fixed in beta040, please pull the latest and have another try.

Thanks,
Ben

Hi Ben,

This seems to have fixed the problem.

Thanks,
Guido

That’s Great! :grinning:

Hi Ben,

I unfortunately have to come back to my earlier message.

During measuring, in the TrackOverlay function (mapView2.TrackOverlay.TrackMode = TrackMode.Line), vertex points are being generated automatically.

After a mouse click and movement, a point is automatically created for the line as soon as I hold the mouse still for a moment. After that I can move as much as I want, but there’s no problem. Then again, after another mouse click on my part, a point is created again as soon as I hold the mouse still for a moment.

Is this related to the previous problem and can this be resolved?

Kind regards, Guido van den Boom