flutter-mapbox-gl / maps

A Mapbox GL flutter package for creating custom maps
Other
1.04k stars 503 forks source link

[Android] SDF images are colored as defined when adding image to controller but not when referenced directly when adding symbol #1251

Closed assemblethis closed 1 year ago

assemblethis commented 1 year ago

I noticed that the following code doesn't work for SDF images that need to be colored:

    final symbol = await mapController?.addSymbol(
        SymbolOptions(
          geometry: LatLng(latitude, longitude),
          iconImage: 'assets/images/winterbolt.png',
          iconSize: 0.5,
          iconColor: 'red',
        )
    );

But the following does work and correctly colors the image red:

      final bytes = await rootBundle.load('assets/images/winterbolt.png');
      final list = bytes.buffer.asUint8List();
      await mapController?.addImage('winterbolt', list, true);

      // place Symbol
      final symbol = await mapController?.addSymbol(
        SymbolOptions(
          geometry: LatLng(latitude, longitude),
          iconImage: 'winterbolt',
          iconSize: 0.5,
          iconColor: 'red',
        ),
      );

Maybe the solution is just to add a parameter for SDF to addSymbol?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.