[MapProxy] How do I get these tile sets overlayed with transparency?

Daniel Cebulla daniel.cebulla at jena.de
Tue Dec 3 04:49:57 PST 2024


Hi Michael,

maybe this is not an issue with Mapproxy and more a case of 
understanding the term "transparency" ...

If a layer is transparent within mapproxy it means, that parts of the 
cached images where there are no features visible, are transparent as 
you know this from a png image for example. So this layer could be used 
to overlay other layers.

Here is an example of some public layers I provide:

Basemap without Labels:
https://map.jena.de/mapproxy/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=&TRANSPARENT=true&LAYERS=Stadtplan_flae&SRS=EPSG:25832&CRS=EPSG:25832&TILED=false&DPI=96&OPACITIES=255&__t=1733229586415&WIDTH=1920&HEIGHT=945&BBOX=680695.4714761135,5644588.346248855,682679.7194761134,5645564.968311355

Labels (with transparency):
https://map.jena.de/mapproxy/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=&TRANSPARENT=true&LAYERS=Stadtplan_label&SRS=EPSG:25832&CRS=EPSG:25832&TILED=false&DPI=96&OPACITIES=255&__t=1733229586415&WIDTH=1920&HEIGHT=945&BBOX=680695.4714761135,5644588.346248855,682679.7194761134,5645564.968311355

Both combined:
https://map.jena.de/mapproxy/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=&TRANSPARENT=true&LAYERS=Stadtplan_flae,Stadtplan_label&SRS=EPSG:25832&CRS=EPSG:25832&TILED=false&DPI=96&OPACITIES=255&__t=1733229586415&WIDTH=1920&HEIGHT=945&BBOX=680695.4714761135,5644588.346248855,682679.7194761134,5645564.968311355


You are trying to get the WMS layers from basemap.de get to work in 
mapproxy. But requesting this WMS layers, there is no transparency 
within the source layer at all:
https://sgx.geodatenzentrum.de/wms_basemapde_schummerung?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=&TRANSPARENT=true&LAYERS=de_basemapde_web_raster_hillshade&SRS=EPSG:25832&CRS=EPSG:25832&TILED=false&DPI=96&OPACITIES=255&__t=1733229586415&WIDTH=1920&HEIGHT=945&BBOX=680695.4714761135,5644588.346248855,682679.7194761134,5645564.968311355

So mapproxy are not able to provide/cache transparent image parts, as 
there are none...


Is there a chance, that the term you are looking for in your use case is 
"opacity" instead?? ...

 From the docs:

*opacity
*Configures the opacity of a layer or cache. This value is used when the 
source or cache is placed on other layers and it can be used to overlay 
non-transparent images. It does not alter the image itself, and only 
effects when multiple layers are merged to one image. The value should 
be between 0.0 (full transparent) and 1.0 (opaque, i.e. the layers below 
will not be rendered).

https://mapproxy.github.io/mapproxy/latest/configuration.html#image-format-options


Greetings Daniel


Am 03.12.24 um 13:15 schrieb Michael Heerdegen via MapProxy:
> Daniel Cebulla via MapProxy<mapproxy at lists.osgeo.org> writes:
>
>> Hi Michael,
> Hi Daniel!
>
>> [...] I think you have to sett "paletted" to "false" to get this work.
> Thank you very much.
>
> Unfortunately it doesn't make a difference.
>
>
>> I am using transparent caches and I have set this option to false, so
>> I think this should solve the issue.
> Are you able to share an example?  You can send it to me privately.
>
>
> Anyway, it seems that transparency is a bigger issue, there are several
> related "doesn't work at all" kind bugs: 
> https://github.com/mapproxy/mapproxy/issues?q=is%3Aissue+is%3Aopen+transparency 
> and it also seems that the behavior at least sometimes and partially 
> depends on the environment (installed image processing libraries, 
> python stuff, whatever). Whatever I tried to affect the image format, 
> the cached tiles are always reported as 8 bit by the "file" command.  Didn't investigate much
> further here.  Dunno if the "file" output is reliable.  Gimp didn't
> dissent for the tiles I tried, though.
>
> In theory, mapproxy should be able to interpret (near) white as
> transparent, independent from alpha channels, AFAIU.  But this also
> doesn't work reliably (see the bug reports).
>
> Also note that I can advice my cache with disable_storage: true - or
> disable caching entirely, building the layer directly from the sources.
> The visual result is always exactly the same, unexpected one.  The
> problem is not cache related.
>
> The only real transparency I have ever seen is the example in this
> report:
>
>    https://github.com/mapproxy/mapproxy/issues/952
>
> where already the source contains multiple layers.
>
> If anyone could contribute a working example involving transparency, I
> would maybe be able to find out what makes a difference and find a
> workaround for my use case.
>
>
> Thank you,
>
> Michael.
> _______________________________________________
> MapProxy mailing list
> MapProxy at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapproxy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapproxy/attachments/20241203/363fde1c/attachment-0001.htm>


More information about the MapProxy mailing list