This commit is contained in:
javi 2015-11-06 11:03:19 +01:00
parent c27b2471da
commit 53d5072c4b

View File

@ -39,16 +39,6 @@
NAME: "tileJSON",
filterRange: function(attrIndex, min, max) {
this.filter = attrIndex + "=" + min + "," + max;
this.reload()
},
filterExact: function(attrIndex, exact) {
this.filter = attrIndex + "=" + exact
this.reload()
},
/**
* return the torque tile encoded in an efficient javascript
* structure:
@ -259,14 +249,11 @@
var limit_x = Math.pow(2, zoom);
var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x;
var index = Math.abs(corrected_x + coord.y) % subdomains.length;
var url = this.tileUrls[(corrected_x + coord.y) % this.tileUrls.length]
var url = this.templateUrl
.replace('{x}', corrected_x)
.replace('{y}', coord.y)
.replace('{z}', zoom)
.replace('{s}', subdomains[index])
if (this.filter) {
url += "?" + this.filter
}
torque.net.get( url , function (data) {
if (data && data.responseText) {
var rows = JSON.parse(data.responseText);
@ -338,7 +325,6 @@
self.options[k] = data[k];
}
self.templateUrl = data.tiles[0];
self.tileUrls = data.tiles;
if (self.templateUrl.indexOf("http") !== 0){
self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl;
}
@ -348,4 +334,4 @@
}
};
module.exports = tileJSON;
module.exports = tileJSON;