first pass at changing map tile params for latest site update
This commit is contained in:
parent
5845c37daf
commit
3e7724afe6
@ -165,7 +165,7 @@ window.setupMap = function() {
|
||||
center: [0,0],
|
||||
zoom: 1,
|
||||
zoomControl: (typeof android !== 'undefined' && android && android.showZoom) ? android.showZoom() : true,
|
||||
minZoom: 5,
|
||||
minZoom: MIN_ZOOM,
|
||||
// zoomAnimation: false,
|
||||
markerZoomAnimation: false,
|
||||
bounceAtZoomLimits: false
|
||||
|
@ -76,7 +76,7 @@ window.extractFromStock = function() {
|
||||
// a reasonable array length for tile parameters
|
||||
// need to find two types:
|
||||
// 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) {
|
||||
// check for tile levels
|
||||
@ -93,7 +93,7 @@ window.extractFromStock = function() {
|
||||
}
|
||||
} // 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;
|
||||
for (var i=1; i<topObject.length; i++) {
|
||||
if (topObject[i-1] > topObject[i]) {
|
||||
|
@ -10,14 +10,11 @@
|
||||
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
|
||||
|
||||
|
||||
|
||||
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];
|
||||
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];
|
||||
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_LEVEL = [ 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 3, 2, 2, 1, 1 ];
|
||||
|
||||
if (niantic_params.ZOOM_TO_LEVEL && niantic_params.TILES_PER_EDGE) {
|
||||
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
|
||||
level = level+1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var maxTilesPerEdge = ZOOM_TO_TILES_PER_EDGE[ZOOM_TO_TILES_PER_EDGE.length-1];
|
||||
|
||||
return {
|
||||
level: level,
|
||||
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
|
||||
};
|
||||
}
|
||||
@ -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
|
||||
// of tilesPerEdge and portal levels visible
|
||||
|
||||
while (zoom > 5) {
|
||||
while (zoom > MIN_ZOOM) {
|
||||
var newTileParams = getMapZoomTileParameters(zoom-1);
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user