[MapProxy] Tiff images vertically swapped

Martin Dirichs mapproxy at dirichs.fastmail.fm
Tue Jul 4 04:59:29 PDT 2017

I found a solution that I want to document here in case
someone has a similar problem one day.

Incorrect rendering of the raster images was unrelated
to MapProxy. Instead, it was caused by a combination
of Mapnik version, datasource specification and the Tiff
images themselves. Here are the two steps I needed to
resolve it:

1. I converted the Tiff images to PNG and back to Tiff to
get rid of information embedded into the original images
(perhaps GeoTIFF?)

2. In the Mapnik configuration, I added a tile_size parameter
to the datasource specification with a value as large as the
width of the respective image. If this parameter is not given,
Mapnik assumes a tile_size of 256, which makes no sense
with these untiled images. This parameter is currently only
documented in the Python API:

Since configuration and raster images worked fine in the
past, I did not suspect Mapnik or the images to be the root
cause at first. Probably there has been a change in Mapnik
behaviour in a recent version.

Martin Dirichs

Am Fr, 9. Jun 2017, um 15:45, schrieb Martin Dirichs:
> Hello,
> I just did a fresh installation of MapProxy on an Ubuntu 16.04
> server using the pre-packaged Mapnik 3.0.9. The Mapnik
> configuration is based on raster images (Tiff) for the top zoom
> levels. Higher zoom levels are based on geo data in a
> PostgreSQL-PostGIS database.
> Looking at the result with the MapProxy demo, I see this for
> zoom level 0:
> http://dynaserv.htwsaar.de/downloads/mapproxy-level-0.png
> The Tiff image seems to be swapped vertically. This can be
> seen in all levels that are based on the raster images, regardless
> of the web service used (WMS / TMS). Higher zoom levels that
> are rendered with the database contents are fine, however.
> This is a configuration I habe been using previously with older
> versions of OS / Mapnik / MapProxy, so I known that the Tiff
> images are correct.
> I am unsure where to look for the error (MapProxy / Mapnik /
> some underlying library)? Any hint is greatly appreciated.
> This is my mapproxy.yaml:
> services:
>   demo:
>   tms:
>   wmts:
>   wms:
>     srs: ['EPSG:3857']
>     image_formats: ['image/png']
> layers:
>   - name: osm
>     sources: [osm_cache]
> caches:
>   osm_cache:
>     sources: [osm_map]
> sources:
>   osm_map:
>     type: mapnik
>     mapfile: /opt/osm-mapnik/mapquest-config.xml
> globals:
>   cache:
>     meta_size: [2, 2]
>     meta_buffer: 80
>     base_dir: /var/cache/mapproxy
>   image:
>     resampling_method: bilinear
>     stretch_factor: 1.15
>     max_shrink_factor: 4.0
>     paletted: true
>     formats:
>       custom_format:
>         format: image/png
> Kind regards,
> Martin Dirichs
> _______________________________________________
> MapProxy mailing list
> MapProxy at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapproxy

More information about the MapProxy mailing list