Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tilelive

Package Overview
Dependencies
Maintainers
22
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tilelive - npm Package Compare versions

Comparing version 5.8.2 to 5.8.3

.eslintrc

3

API.md

@@ -15,2 +15,5 @@ ```javascript

// err is set when the tile does not exist or when retrieval failed.
// If the tile does not exist and that's OK, the error message should
// explicitly read 'Tile does not exist' in order to be handled correctly
// by tilelive.copy.
// otherwise, tile is a buffer containing the compressed image data

@@ -17,0 +20,0 @@ }

@@ -0,1 +1,5 @@

## 5.8.3
* Adds smarter handling of low zoom level tiles to pyramid scheme such that early empty tiles are tolerated without skipping.
## 5.8.2

@@ -2,0 +6,0 @@

9

lib/stream-list.js

@@ -1,10 +0,7 @@

var sm = new (require('sphericalmercator'))();
var Stats = require('./stream-util').Stats;
var Tile = require('./stream-util').Tile;
var Info = require('./stream-util').Info;
var isEmpty = require('./stream-util').isEmpty;
var multiread = require('./stream-util').multiread;
var setConcurrency = require('./stream-util').setConcurrency;
var getTileRetry = require('./stream-util').getTileRetry;
var stream = require('stream');
var Transform = require('stream').Transform;
var util = require('util');

@@ -14,3 +11,3 @@ var queue = require('queue-async');

module.exports = List;
util.inherits(List, stream.Transform);
util.inherits(List, Transform);

@@ -27,3 +24,3 @@ function List(source, options) {

stream.Transform.call(this, {});
Transform.call(this, {});
this._writableState.objectMode = false;

@@ -30,0 +27,0 @@ this._readableState.objectMode = true;

var Stats = require('./stream-util').Stats;
var Tile = require('./stream-util').Tile;
var Info = require('./stream-util').Info;
var stream = require('stream');
var Writable = require('stream').Writable;
var util = require('util');

@@ -10,3 +10,3 @@ var multiwrite = require('./stream-util').multiwrite;

module.exports = Put;
util.inherits(Put, stream.Writable);
util.inherits(Put, Writable);

@@ -46,3 +46,3 @@ function Put(source, options) {

options.objectMode = true;
stream.Writable.call(this, options);
Writable.call(this, options);
}

@@ -49,0 +49,0 @@

@@ -11,3 +11,3 @@ var sm = new (require('sphericalmercator'))();

var getTileRetry = require('./stream-util').getTileRetry;
var stream = require('stream');
var Readable = require('stream').Readable;
var util = require('util');

@@ -17,3 +17,3 @@ var validate = require('./tilelive.js').validate;

module.exports = Pyramid;
util.inherits(Pyramid, stream.Readable);
util.inherits(Pyramid, Readable);

@@ -44,4 +44,5 @@ function Pyramid(source, options) {

this.retry = options.retry || 0;
this.firstz = Infinity;
stream.Readable.call(this, { objectMode: true });
Readable.call(this, { objectMode: true });
}

@@ -74,3 +75,3 @@

if (valid instanceof Error) return stream.emit('error', new Error(valid.message));
for (var z = stream.minzoom; z <= stream.maxzoom; z++) {

@@ -93,3 +94,3 @@ stream.bboxes[z] = sm.xyz(boundsArray, z);

Pyramid.prototype._read = function(size) {
Pyramid.prototype._read = function() {
var stream = this;

@@ -143,3 +144,12 @@

tile = new Tile(z, x, y);
var sum = sumChildren(tile, stream.bboxes);
// stream.firstz flag marks the first zoom level where
// the stream has had non-empty tiles. Skipping is not
// permitted for zoom levels below this as source data
// may not appear at all until this zoom level.
var sum = 0;
if (z >= stream.firstz) {
sum = sumChildren(tile, stream.bboxes);
} else {
addChildren(tile, stream.bboxes, stream.queue);
}
stream.stats.skipped += 1 + sum;

@@ -152,2 +162,3 @@ stream.stats.done += 1 + sum;

} else {
stream.firstz = Math.min(stream.firstz, z);
tile = new Tile(z, x, y, buffer);

@@ -154,0 +165,0 @@ addChildren(tile, stream.bboxes, stream.queue);

@@ -9,3 +9,3 @@ var sm = new (require('sphericalmercator'))();

var getTileRetry = require('./stream-util').getTileRetry;
var stream = require('stream');
var Readable = require('stream').Readable;
var util = require('util');

@@ -15,3 +15,3 @@ var validate = require('./tilelive.js').validate;

module.exports = Scanline;
util.inherits(Scanline, stream.Readable);
util.inherits(Scanline, Readable);

@@ -41,3 +41,3 @@ function Scanline(source, options) {

stream.Readable.call(this, { objectMode: true });
Readable.call(this, { objectMode: true });
}

@@ -80,3 +80,3 @@

Scanline.prototype._read = function(size) {
Scanline.prototype._read = function(/* size */) {
var stream = this;

@@ -83,0 +83,0 @@

@@ -29,3 +29,3 @@ var concurrency = Math.ceil(require('os').cpus().length * 16);

function Tile(z,x,y,buffer) {
function Tile(z, x, y, buffer) {
this.z = isNaN(z) ? undefined : Number(z);

@@ -101,6 +101,8 @@ this.x = isNaN(x) ? undefined : Number(x);

function deserializeInfo(data) {
try { obj = JSON.parse(data); }
catch(err) { throw new DeserializationError('Could not parse data'); }
return new Info(obj);
try {
var obj = JSON.parse(data);
return new Info(obj);
} catch(err) {
throw new DeserializationError('Could not parse data');
}
}

@@ -240,3 +242,3 @@

tries = typeof tries === 'number' ? { max:tries, num:0 } : tries;
source.getTile(z, x, y, function(err, tile, headers) {
source.getTile(z, x, y, function(err /*, tile, headers */) {
if (err && err.message === 'Tile does not exist') {

@@ -243,0 +245,0 @@ callback.apply(this, arguments);

var tilelive = exports;
var fs = require('fs');
var path = require('path');
var url = require('url');
var qs = require('querystring');
var util = require('util');
var os = require('os');
var EventEmitter = require('events').EventEmitter;
var stream = require('stream');
var progress = require('progress-stream');
var queue = require("queue-async");
var queue = require('queue-async');

@@ -23,5 +19,5 @@ global.tileliveProtocols = global.tileliveProtocols || {};

description: '',
version: "1.0.0",
version: '1.0.0',
legend: null,
scheme: "xyz",
scheme: 'xyz',
minzoom: 0,

@@ -66,3 +62,3 @@ maxzoom: 22,

check();
function check(err, uri) {
function check(/* err, uri */) {
if (!protocols.length) {

@@ -101,3 +97,3 @@ return callback(new Error('Tileset does not exist'));

var handler = new tilelive.protocols[uri.protocol](uri, callback);
new tilelive.protocols[uri.protocol](uri, callback);
};

@@ -111,4 +107,4 @@

var keyword = uri.protocol
? uri.protocol.replace(':','')
: path.extname(uri.pathname).replace('.','');
? uri.protocol.replace(':', '')
: path.extname(uri.pathname).replace('.', '');
uri.protocol = uri.protocol || keyword + ':';

@@ -121,3 +117,3 @@

if (typeof(mod.registerProtocols) === 'function') {
if (typeof mod.registerProtocols === 'function') {
mod.registerProtocols(tilelive);

@@ -127,3 +123,4 @@ } else {

}
} catch(err) {};
} catch(err) {
}
});

@@ -164,2 +161,9 @@ }

function first(r) { return r[0]; }
function second(r) { return r[1]; }
function sortByName(a, b) {
return (a[0].name || a[0].id).toLowerCase() <
(b[0].name || b[0].id).toLowerCase() ? -1 : 1;
}
tilelive.list(source, function(err, uris) {

@@ -176,7 +180,5 @@ if (err) return callback(err);

if (!--remaining) {
result.sort(function(a, b) {
return (a[0].name||a[0].id).toLowerCase() < (b[0].name||b[0].id).toLowerCase() ? -1 : 1;
});
var models = result.map(function(r) { return r[0] });
var handlers = result.map(function(r) { return r[1] });
result.sort(sortByName);
var models = result.map(first);
var handlers = result.map(second);
callback(null, models, handlers);

@@ -270,3 +272,3 @@ }

return new Error('vector_layers must be an array of layer objects');
for (var i = 0; i < val.length; i++) {
for (i = 0; i < val.length; i++) {
var lkey = 'vector_layers[' + i + ']';

@@ -359,3 +361,3 @@ if (typeof val[i] !== 'object')

copy(src, dst, options, function(err) {
copy(src, dst, options, function(err) {
if (err) return callback(err);

@@ -422,3 +424,3 @@ if (options.close) closingTime(src, dst, function(err) {

if (typeof src.close === "function") q.defer(function(next) {
if (typeof src.close === 'function') q.defer(function(next) {
src.close(function(err) {

@@ -430,3 +432,3 @@ if (err) return callback(err);

if (typeof dst.close === "function") q.defer(function(next) {
if (typeof dst.close === 'function') q.defer(function(next) {
dst.close(function(err) {

@@ -433,0 +435,0 @@ if (err) return callback(err);

{
"name": "tilelive",
"version": "5.8.2",
"version": "5.8.3",
"main": "./lib/tilelive.js",

@@ -40,3 +40,5 @@ "description": "API for various map tile backends",

"devDependencies": {
"concat-stream": "1.4.x",
"coveralls": "~2.11.1",
"eslint": "^0.24.0",
"istanbul": "~0.3.0",

@@ -46,4 +48,3 @@ "mbtiles": "~0.7.7",

"tilejson": "~0.8.0",
"tilelive-http": "^0.3.0",
"concat-stream": "1.4.x"
"tilelive-http": "^0.3.0"
},

@@ -57,5 +58,5 @@ "bin": {

"scripts": {
"test": "tape test/*.test.js",
"test": "eslint --no-eslintrc -c .eslintrc lib/*.js && tape test/*.test.js",
"cov": "istanbul cover tape test/*.test.js && coveralls < ./coverage/lcov.info"
}
}
# tilelive.js
[![Coverage Status](https://coveralls.io/repos/mapbox/tilelive.js/badge.png)](https://coveralls.io/r/mapbox/tilelive.js)
[![Coverage Status](https://coveralls.io/repos/mapbox/tilelive.js/badge.svg)](https://coveralls.io/r/mapbox/tilelive.js)

@@ -8,3 +8,3 @@ - Tilelive is a module to help interactions between tilelive source modules.

[![Build Status](https://secure.travis-ci.org/mapbox/tilelive.js.png)](http://travis-ci.org/mapbox/tilelive.js)
[![Build Status](https://secure.travis-ci.org/mapbox/tilelive.js.svg)](http://travis-ci.org/mapbox/tilelive.js)

@@ -39,5 +39,5 @@ ## Implementing modules

* `tilelive.info(uri, callback)`: Loads the Tilestore object associated with the specified `uri` and retrieves its metadata in a [TileJSON](http://github.com/mapbox/tilejson) compliant format. `callback` receives an error object (or `null`), the metadata hash and the Tilestore object.
* `tilelive.info(uri, callback)`: Loads the Tilestore object associated with the specified `uri` and retrieves its metadata in a [TileJSON](http://github.com/mapbox/tilejson-spec) compliant format. `callback` receives an error object (or `null`), the metadata hash and the Tilestore object.
* `tilelive.all(source, callback)`: Loads metadata in a [TileJSON](http://github.com/mapbox/tilejson) compliant format for all tilesets in the `source` directory. `callback` receives an error object (or `null`) and an array with TileJSON metadata about each tileset in that directory.
* `tilelive.all(source, callback)`: Loads metadata in a [TileJSON](http://github.com/mapbox/tilejson-spec) compliant format for all tilesets in the `source` directory. `callback` receives an error object (or `null`) and an array with TileJSON metadata about each tileset in that directory.

@@ -44,0 +44,0 @@ * `tilelive.verify(tilejson)`: Validates a TileJSON object and returns error objects for invalid entries.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc