Closed KeithMoyer closed 11 years ago
ah, ok - thanks for the details I'd spotted this V3->V4 change, and added a few notes on #486 - need to look closer at this i think
That zoom change sounds similar to what the 'show-more-portals' plugin does - where it boosts the detail level retrieval by requesting more tiles (but it only does it by 1 level, not 2)
this doesn't really seem like the 'right' solution to their issues though, but perhaps is a temporary work-around.
I don't have a public facing repo for this, so here's a patch inline in this issue (can't see a way to attach it...):
From eed57bf01377f3a86420c93fea491d5842f91bfd Mon Sep 17 00:00:00 2001
From: Keith Moyer <ingress@keithmoyer.com>
Date: Fri, 16 Aug 2013 02:32:46 -0500
Subject: [PATCH] getThinnedEntitiesV4
---
code/map_data.js | 6 +++---
code/map_data_calc_tools.js | 8 ++++----
code/portal_render_limit.js | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/code/map_data.js b/code/map_data.js
index b2a60a4..1216dae 100644
--- a/code/map_data.js
+++ b/code/map_data.js
@@ -216,12 +216,12 @@ window.requestData = function() {
return 0;
});
- data = { zoom: z };
+ data = { };
data.boundsParamsList = tls;
// keep a list of tile_ids with each request. in the case of a server error, we can try and use cached tiles if available
var tile_ids = []
$.each(tls,function(i,req) { tile_ids.push(req.qk); });
- window.requests.add(window.postAjax('getThinnedEntitiesV3', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); }));
+ window.requests.add(window.postAjax('getThinnedEntitiesV4', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); }));
});
// process the requests from the cache
@@ -255,7 +255,7 @@ window.handleFailedRequest = function(tile_ids) {
handleDataResponse(cachedData, true);
}
- if(requests.isLastRequest('getThinnedEntitiesV3')) {
+ if(requests.isLastRequest('getThinnedEntitiesV4')) {
var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null);
handlePortalsRender(leftOverPortals);
}
diff --git a/code/map_data_calc_tools.js b/code/map_data_calc_tools.js
index 33e444c..5018f0a 100644
--- a/code/map_data_calc_tools.js
+++ b/code/map_data_calc_tools.js
@@ -10,20 +10,20 @@
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
window.lngToTile = function(lng, zoom) {
- return Math.floor((lng + 180) / 360 * Math.pow(2, zoom));
+ return Math.floor((lng + 180) / 360 * Math.pow(2, zoom+2));
}
window.latToTile = function(lat, zoom) {
return Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) +
- 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom));
+ 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom+2));
}
window.tileToLng = function(x, zoom) {
- return x / Math.pow(2, zoom) * 360 - 180;
+ return x / Math.pow(2, zoom+2) * 360 - 180;
}
window.tileToLat = function(y, zoom) {
- var n = Math.PI - 2 * Math.PI * y / Math.pow(2, zoom);
+ var n = Math.PI - 2 * Math.PI * y / Math.pow(2, zoom+2);
return 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
}
diff --git a/code/portal_render_limit.js b/code/portal_render_limit.js
index 299f28c..cd1f4cb 100644
--- a/code/portal_render_limit.js
+++ b/code/portal_render_limit.js
@@ -98,7 +98,7 @@ window.portalRenderLimit.splitOrMergeLowLevelPortals = function(originPortals) {
portalRenderLimit.resetCounting();
portalRenderLimit.countingPortals(originPortals);
- var resultPortals = requests.isLastRequest('getThinnedEntitiesV3')
+ var resultPortals = requests.isLastRequest('getThinnedEntitiesV4')
? portalRenderLimit.mergeLowLevelPortals(originPortals)
: portalRenderLimit.splitLowLevelPortals(originPortals);
--
1.7.10.4
It says I closed this issue; if that's true it was accidental. Sorry if you did it and it just says me...
Looks like the exponent isn't continuous. It jumps back between zoom 12-13:
From 47e1817690b4c054c6b8ed7fc61d54425420f053 Mon Sep 17 00:00:00 2001
From: Keith Moyer <ingress@keithmoyer.com>
Date: Fri, 16 Aug 2013 02:32:46 -0500
Subject: [PATCH] getThinnedEntitiesV4
---
code/map_data.js | 6 +++---
code/map_data_calc_tools.js | 8 ++++----
code/portal_render_limit.js | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/code/map_data.js b/code/map_data.js
index b2a60a4..1216dae 100644
--- a/code/map_data.js
+++ b/code/map_data.js
@@ -216,12 +216,12 @@ window.requestData = function() {
return 0;
});
- data = { zoom: z };
+ data = { };
data.boundsParamsList = tls;
// keep a list of tile_ids with each request. in the case of a server error, we can try and use cached tiles if available
var tile_ids = []
$.each(tls,function(i,req) { tile_ids.push(req.qk); });
- window.requests.add(window.postAjax('getThinnedEntitiesV3', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); }));
+ window.requests.add(window.postAjax('getThinnedEntitiesV4', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); }));
});
// process the requests from the cache
@@ -255,7 +255,7 @@ window.handleFailedRequest = function(tile_ids) {
handleDataResponse(cachedData, true);
}
- if(requests.isLastRequest('getThinnedEntitiesV3')) {
+ if(requests.isLastRequest('getThinnedEntitiesV4')) {
var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null);
handlePortalsRender(leftOverPortals);
}
diff --git a/code/map_data_calc_tools.js b/code/map_data_calc_tools.js
index 33e444c..8f845c5 100644
--- a/code/map_data_calc_tools.js
+++ b/code/map_data_calc_tools.js
@@ -10,20 +10,20 @@
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
window.lngToTile = function(lng, zoom) {
- return Math.floor((lng + 180) / 360 * Math.pow(2, zoom));
+ return Math.floor((lng + 180) / 360 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
}
window.latToTile = function(lat, zoom) {
return Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) +
- 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom));
+ 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
}
window.tileToLng = function(x, zoom) {
- return x / Math.pow(2, zoom) * 360 - 180;
+ return x / Math.pow(2, (zoom>12)?zoom:(zoom+2)) * 360 - 180;
}
window.tileToLat = function(y, zoom) {
- var n = Math.PI - 2 * Math.PI * y / Math.pow(2, zoom);
+ var n = Math.PI - 2 * Math.PI * y / Math.pow(2, (zoom>12)?zoom:(zoom+2));
return 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
}
diff --git a/code/portal_render_limit.js b/code/portal_render_limit.js
index 299f28c..cd1f4cb 100644
--- a/code/portal_render_limit.js
+++ b/code/portal_render_limit.js
@@ -98,7 +98,7 @@ window.portalRenderLimit.splitOrMergeLowLevelPortals = function(originPortals) {
portalRenderLimit.resetCounting();
portalRenderLimit.countingPortals(originPortals);
- var resultPortals = requests.isLastRequest('getThinnedEntitiesV3')
+ var resultPortals = requests.isLastRequest('getThinnedEntitiesV4')
? portalRenderLimit.mergeLowLevelPortals(originPortals)
: portalRenderLimit.splitLowLevelPortals(originPortals);
--
1.7.10.4
well it seems to work reasonably well - data fetches correctly. lots of error==TIMEOUT tiles but nothing new there
I need to do some work on the code so IITC handles error==TIMEOUT and retries the requests (as the stock site does), but perhaps with an upper limit on retries to be nice to the servers in case of issues. I have some thoughts on this, but it'll take a bit of time to write the code...
anyway, a new release with this change only will be better than nothing for now
They bumped the version again. The only differences I see: V3->V4 drop the zoom parameter When calculating the tile ID use 2^(zoom+2) instead of 2^zoom.
zoom->minDetail seems to have remained constant. They just broke each of the tiles into multiple pieces (probably to address the timeout issues they've been having).