maplibre / maplibre-native-qt

MapLibre Native Qt Bindings and Qt Location Plugin
https://maplibre.org/maplibre-native-qt/docs/
38 stars 14 forks source link

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

Closed nunojpg closed 1 month ago

nunojpg commented 8 months ago

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.

kebekus commented 6 months ago

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"
          }
        }
ntadej commented 1 month ago

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?