[MapProxy] Browser "Zoom" setting vs. mapproxy
Charles Wilson
cygwin at cwilson.fastmail.fm
Thu Jan 19 08:51:22 PST 2017
I'm using mapproxy (+nginx) as a WMS frontend for a number of separate
services, including an apache/mod_tile/renderd/mapnik openstreetmap tile
server. It's working fine for the most part, but one of my users has
noticed an issue.
If he sets the browser "zoom" level (e.g. on Firefox, clicking the menu
icon reveals a "- 100% +" zoom control; on Chrome, clicking the menu
icon shows a "Zoom - 100% + [_]" control). If this setting is not 100%,
the OpenLayers request to the map server is modified, and fails.
This works (zoom at 100%):
GET
http://server:8088/service?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=osm&TILED=true&WIDTH=256&HEIGHT=256&SRS=EPSG%3A3857&STYLES=&BBOX=-60112525.02836773%2C20037508.342789244%2C-20037508.34278924%2C60112525.02836773
This doesn't (zoom at 80%):
GET
http://server:8088/service?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=osm&TILED=true&WIDTH=205&HEIGHT=205&SRS=EPSG%3A3857&STYLES=&FORMAT_OPTIONS=dpi%3A72&BBOX=-60112525.02836773%2C20037508.342789244%2C-20037508.34278924%2C60112525.02836773
and returns the following:
<?xml version="1.0"?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd">
<ServiceExceptionReport version="1.1.0">
<ServiceException>Invalid request: invalid tile size (use
256x256)</ServiceException>
The difference between the two requests is:
works: &WIDTH=256&HEIGHT=256
doesn't: &WIDTH=205&HEIGHT=205 and &FORMAT_OPTIONS=dpi%3A72
Is there a way to configure mapproxy, in its swiss-army-knife role, to
do this simple resizing itself (thus requesting the original 256x256
tile from the backend tileserver, and then explicitly scaling (*not*
reprojecting) to the requested tile size? Note that setting up an
entirely separate cache (as several "how to create a 512x512 tiles from
a 256x256 tileserver" tutorials recommend) is not appropriate here,
because you have no idea what specific zoom levels the client's browser
will use -- 80%, 90%, 56.123%, 112.65%, ... -- so that "solution" would
end up only supporting the specific browser-zoom-levels for which
separate explicit caches exist.
Here's my current (stripped down) mapproxy configuration:
services:
demo:
wms:
md:
title: MapProxy WMS Proxy
abstract: Proxy for multiple backend geodata services
layers:
- name: osm
title: OpenStreetmap WMS
sources: [osm_cache]
caches:
osm_cache:
grids: [osm_grid]
sources: [osm_source]
disable_storage: true
sources:
osm_source:
type: tile
grid: osm_grid
url: http://osm:80/osm_tiles/%(z)s/%(x)s/%(y)s.png
grids:
osm_grid:
base: GLOBAL_MERCATOR
srs: 'EPSG:3857'
origin: nw
Thanks,
Chuck Wilson
More information about the MapProxy
mailing list