我正在尝试使用Tilestrata在运行Ubuntu 16.04的Digital Ocean Droplet上运行Web地图平铺服务器。设置好所有内容后,我遇到的问题就是这个错误:
carl@Senegal:~/tileserver$ node server.js
/home/carl/node_modules/tilestrata/lib/TileServer.js:502
var callback = function(err) { if (err) throw err; };
^
Error: Unable to initialize "basemap" layer: "expected < at line 1"
at /home/carl/node_modules/tilestrata/lib/TileServer.js:106:19
at /home/carl/node_modules/tilestrata/node_modules/async/lib/async.js:52:16
at done (/home/carl/node_modules/tilestrata/node_modules/async/lib/async.js:243:17)
at /home/carl/node_modules/tilestrata/node_modules/async/lib/async.js:44:16
at Immediate._onImmediate (/home/carl/node_modules/tilestrata/lib/TileRequestHandler.js:125:4)
at processImmediate [as _immediateCallback] (timers.js:383:17)
我的配置应该很好。它与已在Amazon AWS实例上运行的内容完全相同(我想切换到DO,因为它们有更好的定价方案)。我无法弄清楚为什么节点服务器脚本不会读取mapnik xml文件(project.xml)。它与AWS Ubuntu EC2实例上运行良好的XML相同。这是server.js的完整脚本:
var tilestrata = require('tilestrata');
var disk = require('tilestrata-disk');
var mapnik = require('tilestrata-mapnik');
var dependency = require('tilestrata-dependency');
var strata = tilestrata();
// define layers
strata.layer('basemap')
.route('tile.png')
.use(disk.cache({dir: '/home/carl/tileserver/tiles/basemap/'}))
.use(mapnik({
xml: '/home/carl/tileserver/project/project.xml',
tileSize: 256,
scale: 1
}));
// start accepting requests
strata.listen(8080);
我知道脚本正在做某事,因为它成功创建了tiles/basemap
目录。但是Mapnik插件会像没有project.xml文件一样窒息,这个文件肯定是,或者路径错误,但它不是。有什么想法吗?