https://github.com/mapbox/projectmill的python端口
py-projectmill的Python项目详细描述
python 2.5+(包括3.x)的python端口https://github.com/mapbox/projectmill。
目前只支持--mill和--render。
python 2.7、3.2+和pypy-1.9没有任何要求,除非您想运行测试。 要运行测试,只需python setup.py test。
文档的其余部分改编自原始项目。
需要生成一组几乎相同的tilemil项目 然后把它们都渲染出来?写什么剧本?我们查到了。
用法:projectmill <command> [options]
示例:projectmill --mill-c config.example.json -t../tilemill/
安装
最简单的方法就是pip install py-projectmill。
从源安装:pip install -e .或python setup.py install。 如果您使用的是python 2.5、2.6、3.0或3.1,则还需要pip install -rrequirements-X.Y.txt(它们不包括argparse,这是必需的,而2.5需要simplejson)。
测试通过了2.5-3.3和pypy-1.9的所有版本,所以它应该对每个人都有效。
配置
配置应该是一个json文件,其中包含一个数组作为根 目标有关示例,请参见config.example.json。数组中的每个元素 应该是具有以下键的对象:
source REQUIRED The source project, generally the name of folder it lives in. destination REQUIRED The destination project name. mml A json snippet which will be merged on top of the project's mml file. To clear out an option set it to 'null' cartoVars A json object containing key value pairs which can be use to override variables in in carto stylesheets. MBmeta MBTiles: A json object containing key value pairs which will be added to a rendered MBtiles export. Additionally, the following options will be passed to TileMill's export commnd format Export format (png|pdf|svg|mbtiles). (Default: undefined) bbox Array containing coordinates of bounding box to export. (Default: undefined) minzoom MBTiles: minimum zoom level to export. (Default: undefined) maxzoom MBTiles: maximum zoom level to export. (Default: undefined) width Image: image width in pixels. (Default: 400) height Image: image height in pixels. (Default: 400) bufferSize Mapnik render buffer size. (Default: 128)
命令
projectmill接受以下命令。它们也可以发行 单独或一起:
--mill Generates new tilemill projects based on configuration. --render Renders projects that are present in configuration and have been milled. --upload Uploads projects that are present in configuration and have been rendered.
选项
我们还接受以下选项:
-t Path to the TileMill install -c specify a configuration file. (Defaults: ./config.json) -p Path to TileMill project folder. (Defaults: ~/Documents/Mapbox) -f Replace existing projects (together with mill) or existing projects and exports (together with render).