fix #33 by ignoring zoom level 13

brings about 75% storage reduction
master
Thomas Rudin 2018-12-19 16:57:12 +01:00
parent f3caf60f7a
commit 99db881d43
6 changed files with 13 additions and 5 deletions

View File

@ -252,7 +252,8 @@ public class TileRenderer {
logger.trace("Timings of cross-stitched tile X={} Y={} Zoom={}: render={} ms", tileX, tileY, zoom, diff); logger.trace("Timings of cross-stitched tile X={} Y={} Zoom={}: render={} ms", tileX, tileY, zoom, diff);
cache.put(layer.id, tileX, tileY, zoom, data); if (zoom <= cfg.tileCacheMaxZoom())
cache.put(layer.id, tileX, tileY, zoom, data);
if (tile == null) if (tile == null)
logger.error("Got a null-tile @ {}/{}/{} (data={})", tileX, tileY, zoom, data.length); logger.error("Got a null-tile @ {}/{}/{} (data={})", tileX, tileY, zoom, data.length);
@ -323,7 +324,8 @@ public class TileRenderer {
timingImageSetup, timingZeroCountCheck, timingRender, timingBufferOutput timingImageSetup, timingZeroCountCheck, timingRender, timingBufferOutput
); );
cache.put(layer.id, tileX, tileY, zoom, data); if (zoom <= cfg.tileCacheMaxZoom())
cache.put(layer.id, tileX, tileY, zoom, data);
if (tile == null) if (tile == null)
logger.error("Got a null-tile @ {}/{}/{} (layer={},data={})", tileX, tileY, zoom, layer.id, data.length); logger.error("Got a null-tile @ {}/{}/{} (layer={},data={})", tileX, tileY, zoom, layer.id, data.length);

View File

@ -98,6 +98,11 @@ public interface TileServerConfig extends Config {
tile cache stuff tile cache stuff
*/ */
//max cached zoom, 12=default, 13=very file/storage-heavy
@Key("tile.cache.maxzoom")
@DefaultValue("12")
int tileCacheMaxZoom();
@Key("tile.cache.impl") @Key("tile.cache.impl")
@DefaultValue("FILE") @DefaultValue("FILE")
CacheType tileCacheType(); CacheType tileCacheType();

View File

@ -104,6 +104,7 @@ public class InitialTileRendererJob implements Runnable {
double zProgress = (posz - minZ) / (double) zCount; double zProgress = (posz - minZ) / (double) zCount;
TileCoordinate tileCoordinate = CoordinateFactory.getTileCoordinateFromMapBlock(new MapBlockCoordinate(posx, posz)); TileCoordinate tileCoordinate = CoordinateFactory.getTileCoordinateFromMapBlock(new MapBlockCoordinate(posx, posz));
tileCoordinate = CoordinateFactory.getZoomedOutTile(tileCoordinate); //zoom out to 12 (max=13)
try { try {
byte[] data = renderer.render(layer, tileCoordinate.x, tileCoordinate.y, tileCoordinate.zoom); byte[] data = renderer.render(layer, tileCoordinate.x, tileCoordinate.y, tileCoordinate.zoom);

View File

@ -79,7 +79,7 @@ public class TileRoute implements Route {
if (layer == null) if (layer == null)
throw new IllegalArgumentException("layer not found: " + layerid); throw new IllegalArgumentException("layer not found: " + layerid);
if (z < 2) if (z < 2 || z > 12)
throw new IllegalArgumentException("Invalid zoom: " + z); throw new IllegalArgumentException("Invalid zoom: " + z);
//check db cache //check db cache

View File

@ -20,7 +20,7 @@ tileserver.start = function(cfg, layerConfig){
var map = L.map('image-map', { var map = L.map('image-map', {
minZoom: 2, minZoom: 2,
maxZoom: 13, maxZoom: 12,
center: initialCenter, center: initialCenter,
zoom: initialZoom, zoom: initialZoom,
crs: crs crs: crs

View File

@ -1,4 +1,4 @@
#tilerenderer.initialrendering.enable=true tilerenderer.initialrendering.enable=true
#log.tile.updatetimings=true #log.tile.updatetimings=true
tilerenderer.updateinterval=10 tilerenderer.updateinterval=10