flutter-maplibre-gl icon indicating copy to clipboard operation
flutter-maplibre-gl copied to clipboard

Are clusterProperties not implemented for iOS?

Open klivin opened this issue 2 years ago • 3 comments

Hi there,

Referencing this comment:

https://github.com/m0nac0/flutter-maplibre-gl/blob/d2463047306140b747c5f9f692d32d80078fe63e/ios/Classes/SourcePropertyConverter.swift#L102

I've been trying to implement cluster coloring via clusterProperties to use to count the number of like properties and color the cluster accordingly. I'm testing on iOS.

I'm using the following expression for clusterProperties:

var source = GeojsonSourceProperties(
        data: observationLayer,
        cluster: true,
        clusterMaxZoom: 17,
        clusterRadius: 20,
        clusterProperties: {
          "nonCompliantCount": [
            '+',
            ['get', 'nonCompliant']
          ],
          "nullCompliantCount": [
            '+',
            ['get', 'nullCompliant']
          ],
        },
      );

Then I try to access the nonCompliantCount and nullCompliantCount aggregators in the cluster layer, and it is null, as in:

      var clusterProperties = CircleLayerProperties(
        // circleColor: '#34C759',
        circleColor: [
          'case',
          [
            '>',
            ['get', 'nonCompliantCount'],
            0
          ],
          '#D10505',
          [
            '>',
            ['get', 'nullCompliantCount'],
            0
          ],
          '#5C7070',
          '#34C759',
        ],
        circleStrokeWidth: 2,
        circleStrokeColor: '#FFF',
        circleRadius: [
          "step",
          ["get", "point_count"],
          20,
          100,
          30,
          750,
          40
        ],
      );

      addLayerOps.add(mapController.addLayer(
        'observations',
        'observation-clusters',
        clusterProperties,
        filter: [
          "has",
          "point_count",
        ],
      ));

Please let me know if this is not supported at the moment, thank you!

klivin avatar Nov 07 '22 20:11 klivin

I also tested android, and cluster properties are not working there either. clusterProperties are working good in our node/.vue backend however.

klivin avatar Nov 08 '22 01:11 klivin

Same here. Also missing getClusterExpansionZoom method to handle cluster zoom. References: https://docs.mapbox.com/mapbox-gl-js/api/sources/#geojsonsource#getclusterexpansionzoom https://maplibre.org/maplibre-native/android/api/-map-libre%20-native%20for%20-android/com.mapbox.mapboxsdk.style.sources/-geo-json-source/get-cluster-expansion-zoom.html

bohdancorpsoft avatar Feb 15 '24 11:02 bohdancorpsoft

I just stumbled across the same issue, trying to color clusters based on the most common properties within the cluster.

Is there any workaround?

Heidi0039 avatar Feb 20 '24 05:02 Heidi0039