allow -2 and -1 zoom

This commit is contained in:
Laura Klünder 2017-11-28 14:14:03 +01:00
parent 78d09a0c0c
commit 5184206b49
4 changed files with 6 additions and 4 deletions

View file

@ -3,8 +3,8 @@ from django.conf.urls import url
from c3nav.mapdata.views import get_cache_package, map_history, tile, tile_access
urlpatterns = [
url(r'^(?P<level>\d+)/(?P<zoom>\d+)/(?P<x>-?\d+)/(?P<y>-?\d+).png$', tile, name='mapdata.tile'),
url(r'^(?P<level>\d+)/(?P<zoom>\d+)/(?P<x>-?\d+)/(?P<y>-?\d+)/(?P<access_permissions>\d(-\d)*).png$', tile,
url(r'^(?P<level>\d+)/(?P<zoom>-?\d+)/(?P<x>-?\d+)/(?P<y>-?\d+).png$', tile, name='mapdata.tile'),
url(r'^(?P<level>\d+)/(?P<zoom>-?\d+)/(?P<x>-?\d+)/(?P<y>-?\d+)/(?P<access_permissions>\d(-\d)*).png$', tile,
name='mapdata.tile'),
url(r'^history/(?P<level>\d+)/(?P<mode>base|composite)\.(?P<filetype>png|data)$', map_history,
name='mapdata.map_history'),

View file

@ -55,7 +55,7 @@ def tile(request, level, zoom, x, y, access_permissions=None):
enforce_tile_secret_auth(request)
zoom = int(zoom)
if not (0 <= zoom <= 5):
if not (-2 <= zoom <= 5):
raise Http404
cache_package = CachePackage.open_cached()

View file

@ -818,6 +818,8 @@ LevelControl = L.Control.extend({
addLevel: function (id, title) {
this._tileLayers[id] = L.tileLayer((c3nav.tile_server || '/map/') + String(id) + '/{z}/{x}/{y}.png', {
minZoom: -2,
maxZoom: 5,
bounds: L.GeoJSON.coordsToLatLngs(c3nav.bounds)
});
var overlay = L.layerGroup();

View file

@ -135,7 +135,7 @@ class TileServer:
level, zoom, x, y = match.groups()
zoom = int(zoom)
if not (0 <= zoom <= 5):
if not (-2 <= zoom <= 5):
return self.not_found(start_response, b'zoom out of bounds.')
# do this to be thread safe