tileblaster 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.js.dist CHANGED
@@ -36,6 +36,9 @@ module.exports = {
36
36
 
37
37
  // url points to cloudtiles container (→ https://github.com/OpenCloudTiles/opencloudtiles-specification)
38
38
  "cloudtiles": false,
39
+
40
+ // backend uses tms instead of zxy
41
+ "tms": false,
39
42
 
40
43
  // possible extensions
41
44
  "ext": ["mvt","json","topojson","png","jpg"],
@@ -537,7 +537,7 @@ tileblaster.prototype.fetchtile = function(tileurl, mapid, fn){
537
537
  tileblaster.prototype.cloudtile = function(tileurl, mapid, z, x, y, fn) {
538
538
  const self = this;
539
539
  if (!cloudtiles) return fn(new Error("Missing dependency: cloudtiles"));
540
- if (!self.maps[mapid].c) self.maps[mapid].c = cloudtiles(tileurl);
540
+ if (!self.maps[mapid].c) self.maps[mapid].c = cloudtiles(tileurl, { tms: !!self.maps[mapid].tms });
541
541
  self.maps[mapid].c.getTile(z,x,y, function(err, buffer){
542
542
  if (err) return fn(err);
543
543
  return fn(null, stream.Readable.from(buffer));
@@ -707,6 +707,10 @@ tileblaster.prototype._checktile = function(mapid, z, x, y, r, ext, fn){
707
707
  // transform parameters to url
708
708
  tileblaster.prototype._tileurl = function(mapid, z, x, y, r, e){
709
709
  var self = this;
710
+
711
+ // when backend uses tms
712
+ if (!!self.maps[mapid].tms) y = Math.pow(2,z)-y-1;
713
+
710
714
  return self.maps[mapid].url
711
715
  .replace("{s}", (self.maps[mapid].sub !== false) ? self.maps[mapid].sub[Math.floor(Math.random()*self.maps[mapid].sub.length)] : "")
712
716
  .replace("{x}", x.toFixed(0))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tileblaster",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "pretty fast optimizing & compressing tile caching proxy",
5
5
  "main": "lib/tileblaster.js",
6
6
  "bin": {
@@ -19,16 +19,16 @@
19
19
  "dependencies": {
20
20
  "debug": "^4.3.4",
21
21
  "dur": "^0.0.3",
22
- "glob": "^8.0.3",
22
+ "glob": "^8.1.0",
23
23
  "minimist": "^1.2.7",
24
- "mkdirp": "^1",
24
+ "mkdirp": "^2.0.0",
25
25
  "node-watch": "^0.7.3",
26
26
  "nsa": "^0.2",
27
27
  "quu": "^0.4.3",
28
28
  "request": "^2.88"
29
29
  },
30
30
  "optionalDependencies": {
31
- "cloudtiles": "^0.0.1",
31
+ "cloudtiles": "^0.0.6",
32
32
  "jpck": "^1.0.2",
33
33
  "node-zopfli": "^2.1.4",
34
34
  "pnck": "^1.0.1"