[MapProxy] transparent layers get an opaque background after merging

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[MapProxy] transparent layers get an opaque background after merging

Tobias Wendorff
Hi there!

I have a problem concerning the merging of two transparent layers: After
merging, the displayed layer gets an opaque white background. The
non-merged layers are displayed transparently - so these should be fine.

The layers are based on MBTiles coming straight out of QGIS. I can't
tell if the PNGs have an alpha channel or "palette transparency".

Enabling a storage for "cache_polygons_patterns_mixed" didn't change the
background.

My Pillow is at version 6.2.2 (last version for Python2). MapProxy and
all its dependencies and system libraries are up to date.

Before filing a bug in Github, am I doing anything wrong?
This might be associated with https://github.com/mapproxy/mapproxy/issues/2

Best regards,
Tobias

layers:
  - name: polygons_solid
    title: polygons_solid
    sources: [cache_polygons]
  - name: patterns
    title: patterns
    sources: [cache_patterns]
  - name: polygons_patterns_mixed_layer
    title: polygons_patterns_mixed_layer
    sources: [cache_polygons, cache_patterns]
  - name: polygons_patterns_mixed_cache
    title: polygons_patterns_mixed_cache
    tile_sources: [cache_polygons_patterns_mixed]

caches:
  cache_polygons_patterns_mixed:
    sources: [cache_polygons, cache_patterns]
    grids: [osm_grid]
    disable_storage: true
  cache_patterns:
    sources: []
    grids: [osm_grid]
    cache:
      type: mbtiles
      filename: /srv/mapproxy/data/patterns.mbtiles
  cache_polygons:
    sources: []
    grids: [osm_grid]
    cache:
      type: mbtiles
      filename: /srv/mapproxy/data/polygons.mbtiles

grids:
  osm_grid:
    base: GLOBAL_MERCATOR
    srs: 'EPSG:3857'
    origin: nw

globals:
  cache:
    base_dir: '/srv/mapproxy/cache_data'
    lock_dir: '/srv/mapproxy/cache_data/locks'
    tile_lock_dir: '/srv/mapproxy/cache_data/tile_locks'
    concurrent_tile_creators: 2
    link_single_color_images: true
  image:
    paletted: true
    formats:
      custom_format:
        format: image/png
        mode: P
        colors: 32
        transparent: true
        encoding_options:
          quantizer: fastoctree
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] transparent layers get an opaque background after merging

Travis Kirstine
You may need to define a request_format: image/png to the cache to ensure that the source images are transparent.


On Tue, 13 Oct 2020 at 14:08, Tobias Wendorff <[hidden email]> wrote:
Hi there!

I have a problem concerning the merging of two transparent layers: After
merging, the displayed layer gets an opaque white background. The
non-merged layers are displayed transparently - so these should be fine.

The layers are based on MBTiles coming straight out of QGIS. I can't
tell if the PNGs have an alpha channel or "palette transparency".

Enabling a storage for "cache_polygons_patterns_mixed" didn't change the
background.

My Pillow is at version 6.2.2 (last version for Python2). MapProxy and
all its dependencies and system libraries are up to date.

Before filing a bug in Github, am I doing anything wrong?
This might be associated with https://github.com/mapproxy/mapproxy/issues/2

Best regards,
Tobias

layers:
  - name: polygons_solid
    title: polygons_solid
    sources: [cache_polygons]
  - name: patterns
    title: patterns
    sources: [cache_patterns]
  - name: polygons_patterns_mixed_layer
    title: polygons_patterns_mixed_layer
    sources: [cache_polygons, cache_patterns]
  - name: polygons_patterns_mixed_cache
    title: polygons_patterns_mixed_cache
    tile_sources: [cache_polygons_patterns_mixed]

caches:
  cache_polygons_patterns_mixed:
    sources: [cache_polygons, cache_patterns]
    grids: [osm_grid]
    disable_storage: true
  cache_patterns:
    sources: []
    grids: [osm_grid]
    cache:
      type: mbtiles
      filename: /srv/mapproxy/data/patterns.mbtiles
  cache_polygons:
    sources: []
    grids: [osm_grid]
    cache:
      type: mbtiles
      filename: /srv/mapproxy/data/polygons.mbtiles

grids:
  osm_grid:
    base: GLOBAL_MERCATOR
    srs: 'EPSG:3857'
    origin: nw

globals:
  cache:
    base_dir: '/srv/mapproxy/cache_data'
    lock_dir: '/srv/mapproxy/cache_data/locks'
    tile_lock_dir: '/srv/mapproxy/cache_data/tile_locks'
    concurrent_tile_creators: 2
    link_single_color_images: true
  image:
    paletted: true
    formats:
      custom_format:
        format: image/png
        mode: P
        colors: 32
        transparent: true
        encoding_options:
          quantizer: fastoctree
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy

_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] transparent layers get an opaque background after merging

Tobias Wendorff
Thanks for your idea, I thought "request_format" is for WMS only.

But it didn't work:

```
  format: image/png
  request_format: image/png
```

This also would work in "caches" only, not in "layers" (where merging is
also allowed).

It really might be a Pillow problem. I'll try to extract the images from
the mbtiles and analyze them.


Am 13.10.2020 um 20:38 schrieb Travis Kirstine:
> You may need to define a request_format: image/png to the cache to
> ensure that the source images are transparent.
>
https://mapproxy.org/docs/latest/configuration.html?highlight=request_format#request-format
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] transparent layers get an opaque background after merging

Tobias Wendorff
In reply to this post by Tobias Wendorff
I've created a testcase using my data and PIL. They get merged with
transparent background. So it seems to be an issue of MapProxy.

I'll try to use the code from MapProxy and write a bug report or patch.


Am 13.10.2020 um 19:26 schrieb Tobias Wendorff:
> My Pillow is at version 6.2.2 (last version for Python2). MapProxy and
> all its dependencies and system libraries are up to date.
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] transparent layers get an opaque background after merging

Tobias Wendorff
Hell... sometimes you just need to read the code AND documentation:
https://mapproxy.org/docs/nightly/configuration.html#image

This did it:

caches:
  cache_polygons_patterns_mixed:
    sources: [cache_polygons, cache_patterns]
    grids: [osm_grid]
    disable_storage: true
    image:
      transparent: true

Living in the code since v1.1.0 ;)


Am 13.10.2020 um 22:01 schrieb Tobias Wendorff:
> I've created a testcase using my data and PIL. They get merged with
> transparent background. So it seems to be an issue of MapProxy.
>
> I'll try to use the code from MapProxy and write a bug report or patch.
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy