Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downscaling mechanism incompatibility with coverage clipping #849

Open
alfmarcua opened this issue Jan 3, 2024 · 1 comment
Open

Downscaling mechanism incompatibility with coverage clipping #849

alfmarcua opened this issue Jan 3, 2024 · 1 comment

Comments

@alfmarcua
Copy link
Contributor

Context

The downscale tiles mechanism does not work with clip: true inside the coverage parameter of the source.

It was detected as a problem with downscaling #687 but downscaling only fails together with clipping.

Expected Behavior

Tiles should be generated in the missing layers from a higher zoom with clipping.

Actual Behavior

Blank tiles still appear in downscale zoom levels. Although, seeding works fine between min_scale and max_scale of the source.

Possible Fix

The solution found was to modify the file:
/usr/local/lib/python3.10/dist-packages/mapproxy/cache/tile.py In the "_load_tile_coords" function.

  • Condition ( if not created_tiles and self.rescale_tiles ) has been changed to ( if blank_created_tiles and self.rescale_tiles ).
  • Added the next code right before the previous condition:
    blank_created_tiles = False
    for tile in created_tiles:
    if tile.source_image().mode == 'RGBA':
    if all(tile.source_image().load()[x, y][3] == 0 for x in range(tile.source_image().width) for y in range(tile.source_image().height)) :
    blank_created_tiles = True

Steps to Reproduce

  1. Create a cache with zooms that are out of the scale limits of the source.
  2. Add the parameter downscale_tiles with any value greater or equal to 1.
  3. Add a coverage to the source with clip: true and a datasource for the coverage.
  4. Check if there is any blank tile in downscaling zoom levels.

The following configuration shows that there is some incompatibility between the combined use of the datasource and clip: true parameters with downscaling.

If we simply remove the clip: true parameter the following configuration will work, otherwise everything will be blank except the zoom indicated between min_scale and max_scale, which in this case is zoom 12.

services:
  demo:
  tms:
    use_grid_names: true
    # origin for /tiles service
    origin: 'nw'
  kml:
      use_grid_names: true
  wmts:
  wms:
    md:
      title: MapProxy WMS Proxy
      abstract: This is a minimal MapProxy example.

layers:
  - name: osm
    title: Omniscale OSM WMS - osm.omniscale.net
    sources: [osm_cache]

caches:
  osm_cache:
    grids: [webmercator]
    sources: [osm_wms]
    downscale_tiles: 2

sources:
  osm_wms:
    coverage:
      clip: true
      datasource: EU.txt
      srs: EPSG:3857
    type: wms
    min_scale: 100000
    max_scale: 150000
    req:
      url: https://maps.omniscale.net/v2/demo/style.default/service?
      layers: osm

grids:
    webmercator:
        base: GLOBAL_WEBMERCATOR

globals:

Context

The aim was to ensure that there were no blank tiles in downscaling zooms in those layers that required it.

Your Environment

  • Version used: checked in MapProxy 1.14 and MapProxy 1.16
  • Environment name and version: Python 3.10
  • Server type and version:
  • Operating System and version: Ubuntu
@alfmarcua
Copy link
Contributor Author

Here you have the coverage used: EU.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant