maplibre-native-qt icon indicating copy to clipboard operation
maplibre-native-qt copied to clipboard

setFilter documented example returns "Error parsing filter: filter operator must be a string"

Open nunojpg opened this issue 1 year ago • 2 comments

src/core/map.cpp setFilter has the example:

        QVariantList filterExpression;
        filterExpression.push_back(QLatin1String("=="));
        filterExpression.push_back(QLatin1String("$type"));
        filterExpression.push_back(QLatin1String("Point"));

        QVariantList filter;
        filter.push_back(filterExpression);

        map->setFilter(QLatin1String("marker"), filter);

This returns error "Error parsing filter: filter operator must be a string".

I have tried to run in several variant list combinations and also to quote the string contents, but I always get some error.

nunojpg avatar Jan 21 '24 00:01 nunojpg

Same problem here, when I try to use the following code in QML.

@ntadej Do you have any idea? Any help would be greatly appreciated.


        LayerParameter {
          id:  airspaceLabels

          styleId: "AirspaceLabels"

          type: "symbol"
          property string source: "aviation-data"
          property string filter: '["==", ["GET", "TYP"], "AS"]'
          property string metadata: '{}'

          layout: {
              "symbol-placement": "line",
              "text-allow-overlap": false,
              "text-anchor": "center",
              "text-field": Navigator.aircraft.verticalDistanceUnit === Aircraft.Meters ? '["get", "MLM"]' : '["get", "MLI"]',
              "text-ignore-placement": false,
              "text-justify": "center",
              "text-offset": '[0,1]',
              "text-optional": true,
              "text-size": 12
          }

          paint: {
              "text-halo-width": 2,
              "text-halo-color": "white"
          }
        }

kebekus avatar Apr 07 '24 08:04 kebekus

Sorry, just got back to this. Is there a minimal reproducer style that I could use to reproduce this and potentially even include in the tests?

ntadej avatar Aug 15 '24 18:08 ntadej