Handle limits error in GMaps

This commit is contained in:
rubenmoya 2017-11-07 11:35:17 +01:00
parent e83bcaee6d
commit 5d89990119

View File

@ -180,7 +180,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
// for each tile shown on the map request the data // for each tile shown on the map request the data
onTileAdded: function(t) { onTileAdded: function(t) {
var self = this; var self = this;
this.provider.getTileData(t, t.zoom, function(tileData) { var successCallback = function (tileData) {
// don't load tiles that are not being shown // don't load tiles that are not being shown
if (t.zoom !== self.map.getZoom()) return; if (t.zoom !== self.map.getZoom()) return;
self._tileLoaded(t, tileData); self._tileLoaded(t, tileData);
@ -188,7 +188,12 @@ GMapsTorqueLayer.prototype = torque.extend({},
if (tileData) { if (tileData) {
self.redraw(); self.redraw();
} }
}); };
var errorCallback = function (error) {
self.fire('tileError', error);
}
this.provider.getTileData(t, t.zoom, successCallback, errorCallback);
}, },
clear: function() { clear: function() {
@ -325,7 +330,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
console.log('Torque layer: CartoCSS style on named maps is read-only'); console.log('Torque layer: CartoCSS style on named maps is read-only');
return false; return false;
} }
var shader = new carto.RendererJS().render(cartocss); var shader = new carto.RendererJS().render(cartocss);
this.shader = shader; this.shader = shader;
if (this.renderer) { if (this.renderer) {
@ -406,7 +411,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
} }
return c; return c;
}, },
getValueForBBox: function(x, y, w, h) { getValueForBBox: function(x, y, w, h) {
var xf = x + w, yf = y + h; var xf = x + w, yf = y + h;
var sum = 0; var sum = 0;