first pass at changing map tile params for latest site update

This commit is contained in:
Jon Atkins 2015-04-03 20:50:10 +01:00
parent 5845c37daf
commit 3e7724afe6
3 changed files with 10 additions and 12 deletions

View File

@ -165,7 +165,7 @@ window.setupMap = function() {
center: [0,0], center: [0,0],
zoom: 1, zoom: 1,
zoomControl: (typeof android !== 'undefined' && android && android.showZoom) ? android.showZoom() : true, zoomControl: (typeof android !== 'undefined' && android && android.showZoom) ? android.showZoom() : true,
minZoom: 5, minZoom: MIN_ZOOM,
// zoomAnimation: false, // zoomAnimation: false,
markerZoomAnimation: false, markerZoomAnimation: false,
bounceAtZoomLimits: false bounceAtZoomLimits: false

View File

@ -76,7 +76,7 @@ window.extractFromStock = function() {
// a reasonable array length for tile parameters // a reasonable array length for tile parameters
// need to find two types: // need to find two types:
// a. portal level limits. decreasing numbers, starting at 8 // a. portal level limits. decreasing numbers, starting at 8
// b. tiles per edge. increasing numbers. current max is 9000 // b. tiles per edge. increasing numbers. current max is 36000, 9000 was the previous value
if (topObject[0] == 8) { if (topObject[0] == 8) {
// check for tile levels // check for tile levels
@ -93,7 +93,7 @@ window.extractFromStock = function() {
} }
} // end if (topObject[0] == 8) } // end if (topObject[0] == 8)
if (topObject[topObject.length-1] == 9000) { if (topObject[topObject.length-1] == 36000 || topObject[topObject.length-1] == 9000) {
var increasing = true; var increasing = true;
for (var i=1; i<topObject.length; i++) { for (var i=1; i<topObject.length; i++) {
if (topObject[i-1] > topObject[i]) { if (topObject[i-1] > topObject[i]) {

View File

@ -10,14 +10,11 @@
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames // http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
window.getMapZoomTileParameters = function(zoom) { window.getMapZoomTileParameters = function(zoom) {
// var ZOOM_TO_TILES_PER_EDGE = [64, 64, 128, 128, 256, 256, 256, 1024, 1024, 1536, 4096, 4096, 6500, 6500, 6500]; var ZOOM_TO_TILES_PER_EDGE = [256, 256, 256, 256, 512, 512, 512, 2048, 2048, 2048, 4096, 4096, 6500, 6500, 6500, 18e3, 18e3, 36e3];
// var ZOOM_TO_TILES_PER_EDGE = [256, 256, 256, 256, 512, 512, 512, 2048, 2048, 2048, 4096, 4096, 6500, 6500, 6500]; var ZOOM_TO_LEVEL = [ 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 3, 2, 2, 1, 1 ];
var ZOOM_TO_TILES_PER_EDGE = [256, 256, 256, 256, 512, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 6500, 6500, 6500];;
var MAX_TILES_PER_EDGE = 9000;
// var ZOOM_TO_LEVEL = [8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 3, 2, 2, 1, 1];
var ZOOM_TO_LEVEL = [8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 2, 1, 1];
if (niantic_params.ZOOM_TO_LEVEL && niantic_params.TILES_PER_EDGE) { if (niantic_params.ZOOM_TO_LEVEL && niantic_params.TILES_PER_EDGE) {
ZOOM_TO_LEVEL = niantic_params.ZOOM_TO_LEVEL; ZOOM_TO_LEVEL = niantic_params.ZOOM_TO_LEVEL;
@ -35,13 +32,14 @@ window.getMapZoomTileParameters = function(zoom) {
// reduce portal detail level by one - helps reduce clutter // reduce portal detail level by one - helps reduce clutter
level = level+1; level = level+1;
} }
} }
var maxTilesPerEdge = ZOOM_TO_TILES_PER_EDGE[ZOOM_TO_TILES_PER_EDGE.length-1];
return { return {
level: level, level: level,
maxLevel: ZOOM_TO_LEVEL[zoom] || 0, // for reference, for log purposes, etc maxLevel: ZOOM_TO_LEVEL[zoom] || 0, // for reference, for log purposes, etc
tilesPerEdge: ZOOM_TO_TILES_PER_EDGE[zoom] || MAX_TILES_PER_EDGE, tilesPerEdge: ZOOM_TO_TILES_PER_EDGE[zoom] || maxTilesPerEdge,
zoom: zoom // include the zoom level, for reference zoom: zoom // include the zoom level, for reference
}; };
} }
@ -66,7 +64,7 @@ window.getDataZoomForMapZoom = function(zoom) {
// to avoid impacting server load, we keep ourselves restricted to a zoom level with the sane numbre // to avoid impacting server load, we keep ourselves restricted to a zoom level with the sane numbre
// of tilesPerEdge and portal levels visible // of tilesPerEdge and portal levels visible
while (zoom > 5) { while (zoom > MIN_ZOOM) {
var newTileParams = getMapZoomTileParameters(zoom-1); var newTileParams = getMapZoomTileParameters(zoom-1);
if (newTileParams.tilesPerEdge != origTileParams.tilesPerEdge || newTileParams.level != origTileParams.level) { if (newTileParams.tilesPerEdge != origTileParams.tilesPerEdge || newTileParams.level != origTileParams.level) {
// switching to zoom-1 would result in a different detail level - so we abort changing things // switching to zoom-1 would result in a different detail level - so we abort changing things