You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a tilelive server to host my mbtiles files and load them locally. Currently, my server looks like this (taken from this post):
var express = require('express');
var http = require('http');
var app = express();
var tilelive = require('@mapbox/tilelive');
require('@mapbox/mbtiles').registerProtocols(tilelive);
tilelive.load('mbtiles://./file.mbtiles', function(err, source) {
if (err) {
throw err;
}
app.set('port', 7777);
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get(/^\/v2\/tiles\/(\d+)\/(\d+)\/(\d+).pbf$/, function(req, res){
var z = req.params[0];
var x = req.params[1];
var y = req.params[2];
console.log('get tile %d, %d, %d', z, x, y);
source.getTile(z, x, y, function(err, tile, headers) {
if (err) {
res.status(404)
res.send(err.message);
console.log(err.message);
} else {
res.set(headers);
res.send(tile);
}
});
});
http.createServer(app).listen(app.get('port'), function() {
console.log('Express server listening on port ' + app.get('port'));
});
});
But, I want to be able to host multiple mbtiles files. For instance, if tilelive could load file1.mbtiles and file2.mbtiles. Then, my query could look like localhost:7777/v2/tiles/file1/{z}/{x}/{y}.pbf. But, I'm not sure how to specify tilelive to load multiple tiles.
Please let me know if you have any ideas. Thanks!
The text was updated successfully, but these errors were encountered:
Hi @ev0065. Have you looked at tessera? I've been using it to host multiple mbtiles files. It works with any tilelive source. It might be more than you need for your problem, but looking at its source code should show you how it handled this problem.
Hi,
I am using a tilelive server to host my mbtiles files and load them locally. Currently, my server looks like this (taken from this post):
But, I want to be able to host multiple mbtiles files. For instance, if tilelive could load
file1.mbtiles
andfile2.mbtiles
. Then, my query could look likelocalhost:7777/v2/tiles/file1/{z}/{x}/{y}.pbf
. But, I'm not sure how to specify tilelive to load multiple tiles.Please let me know if you have any ideas. Thanks!
The text was updated successfully, but these errors were encountered: