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

setLayerVisibility specified in documentation but not available in library

Open noorbakerally opened this issue 1 year ago • 5 comments

The setLayerVisibility is documented in the API Documentation here.

However, it's not available in the codes. I need to configure the visibility of certain map layers, such as contour, summit, carparks, etc. Is there another way to do this via the map controller?

noorbakerally avatar Aug 24 '22 08:08 noorbakerally

This feature was merged in #138, and is not yet in a release. You need to use the main branch from this repo, are you doing that?

m0nac0 avatar Aug 24 '22 08:08 m0nac0

Yes, I found this, I wasn't using the main branch, just to confirm, can we use this for hiding or displaying layers like contour-line, mountain-peak, hike-route, bike-route-line, etc?

noorbakerally avatar Aug 25 '22 09:08 noorbakerally

Yes, if those layers exist you should be able to hide/show them.

m0nac0 avatar Aug 25 '22 10:08 m0nac0

How about getting a layer object and modifying it's properties?

For example,

I am adding a layer with id tracker as shown below. How do I get the layer object if I need to modify it layer, for example, changing the iconSize or iconRotate property. The future that addSymbolLayer returns does not contain the layer. Neither do I see any method like getLayer or updateLayer. Is there anything such?

 maplibreMapController.addSymbolLayer(
      "trackerSource",
      "tracker",
      SymbolLayerProperties(
          iconImage: "assets/images/NavIcon.png", //  "{type}-15",
          iconSize: 1,
          iconAllowOverlap: true,
          iconRotationAlignment: 'viewport',
          iconPitchAlignment: 'map',
      ),
    );

noorbakerally avatar Aug 26 '22 12:08 noorbakerally

No this does not exist, yet. The challenge here is that maplibre on iOS does not support retrieving the JSON representation of a source or layer. I have some ideas how to implement this (updating is probably easier than retrieving), but I can't promise you when this will be ready.

If someone is interested in working on this, please let me know and I can give you some more details.

m0nac0 avatar Sep 08 '22 13:09 m0nac0