1

我想使用 mapbox 工具从 MBTiles 矢量数据存储中提供 GeoJson 切片。这可能吗?

到目前为止我所做的:

  • 克隆并安装了很多存储库:TM2、tilelive、tilelive-vector、mbtiles、...
  • 将 shapefile 导入 TM2
  • 应用了一种样式(这对于服务 GeoJson 是否必要?)
  • 导出样式和 MBTiles 数据库

要检查是否可以读取 MBTiles 文件,我已经尝试过了。

var tilelive = require('tilelive');
var MBTiles = require('mbtiles');
MBTiles.registerProtocols(tilelive);
var listsrc = function(src){ console.log('src: ' + src); }
tilelive.list('/home/bergw/Downloads', listsrc);

但它返回:null

尝试使用时会出现更多问题tilelive-vector

var opts = {};
opts.xml = 'file:///home/bergw/getgeojson/project.xml';
//opts.xml = 'file:///home/bergw/shapefiles/source.tm2/data.xml';
opts.format = 'json';
//opts.base = !style.tmpid(id) && uri.pathname;
opts.scale = 1; // data.scale || 1;
opts.source = 'mbtiles:///home/bergw/Downloads/source.mbtiles';
//opts.source = new MBTiles('/home/bergw/Downloads/source.mbtiles')
//opts.source = 'tmsource:///home/bergw/shapefiles/source.tm2';
v = new Vector(opts, done);

project.xml是 mapnik 样式,我从导出的tm2z. 它仍然包含对原始 shapefile 的引用,但如果我不使用它,我会得到Error: No xml.

使用我为 source 参数尝试的所有组合,我得到Error: Invalid tilesource protocol.

任何有关如何进行的帮助或提示哪些其他工具或其组合更合适,我们将不胜感激。

问候, 威廉

4

1 回答 1

1

TileMill 2 旨在将协议缓冲区创建为矢量切片而不是 GeoJSON。它也不是服务器,而是设计和创建工具,因此不适合您当前的用例。像TileStache 的这个教程这样的东西对你来说是一个更好的选择。

于 2013-12-20T21:50:58.943 回答