fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
https://pub.dev/packages/flutter_map
BSD 3-Clause "New" or "Revised" License
2.73k stars 860 forks source link

[BUG] Transparency not applicable #1407

Closed RegalFenster closed 1 year ago

RegalFenster commented 1 year ago

What is the bug?

Hi, for some reason, I'm unable to set the transparency of the wms tile layer. There is a similar issue: https://github.com/fleaflet/flutter_map/issues/1281 But changing the backgroundColor to transparent didn't resolve the problem.

What is the expected behaviour?

Layer should be transparent

How can we reproduce this issue?

FlutterMap(
        options: MapOptions(
          center: LatLng(51.5, -0.09),
          zoom: 13.0,
        ),
        nonRotatedChildren: [
          AttributionWidget.defaultWidget(
            source: 'OpenStreetMap contributors',
          ),
        ],
        children: [
          TileLayer(
            urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
            userAgentPackageName: 'com.example.app',
          ),
          TileLayer(
            wmsOptions: WMSTileLayerOptions(
                baseUrl: "https://geo.weather.gc.ca/geomet?",
                layers: ["GDPS.ETA_TT"],
                version: '1.3.0',
                transparent: true),
            backgroundColor: Colors.transparent,
          ),
        ],
      )

Do you have a potential solution?

No response

Can you provide any other information?

image image

Platforms Affected

Windows

Severity

Minimum: Allows normal functioning

Frequency

Consistently: Always occurs at the same time and location

Requirements

ibrierley commented 1 year ago

I guess the first obvious question is, what's the yellow stuff? :). Are you sure the WMS tile isn't just providing that from the server ?

RegalFenster commented 1 year ago

I updated the issue

ibrierley commented 1 year ago

So, I may be being dumb here, but as the whole weather world/layer is full of colour, why would transparent work, there's no transparency there ?

JaffaKetchup commented 1 year ago

Hi @RegalFenster, I think you might be getting confused. My mistake if I'm misunderstanding you!

backgroundColor sets the color behind any transparent areas of the map (of which there aren't any on this map). If you're trying to set the opacity of the entire layer, perhaps to overlay it on top of another layer, set the opacity property instead.

(Not sure if you're trying to do this or not, but to toggle the layer, toggle the TileLayer itself: don't use 0 opacity)

RegalFenster commented 1 year ago

I was confused indeed. Changing the opacity is what I actually wanted. Thanks a lot!