Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Data property in annotations not added to properties #462

Open
XanderD99 opened this issue Jun 11, 2024 · 0 comments
Open

[BUG] Data property in annotations not added to properties #462

XanderD99 opened this issue Jun 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@XanderD99
Copy link
Contributor

XanderD99 commented Jun 11, 2024

Platforms

all

Version of flutter maplibre_gl

latest

Bug Description

The data property that can be passed to the annotations is not added to the properties in geojson.

I know it can be done by setting the annotationColor properties from the specific annotation options but that would create such a messy function with a lot of nested if elses or switch cases that I rather just add in custom properties with a customised layer so that the map styles handle it

Other then that I think it will also benefit that the general onFeatureTapped also gets all the data properties that are in that feature.

Steps to Reproduce

  1. Create custom annotation layer style with data driven element
  2. Create annotation with data property set to anything
  3. add annotation to map

Expected Results

Data properties to be added to the geojson properties so that they can be used in layer styles.

Actual Results

data is not used or passed to the togeojson

Code Sample

class EventLayerManager extends AnnotationManager {
  EventLayerManager(super.controller) : super(enableInteraction: false);

  void addEvent(final LatLng geometry, final String type) async {
    final options = CircleOptions(geometry: geometry);

    final circle = Circle('some_id', options, {'type': type});

    await add(circle);
  }

  @override
  List<LayerProperties> get allLayerProperties => [
        CircleLayerProperties(
          circleRadius: 2,
          circleColor: [
            'match',
            ['get', 'type'],
            'accident', 'red',
            'blue',
          ],
        ),
      ];
}
@XanderD99 XanderD99 added the bug Something isn't working label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant