通过额外的命令扩展morecantile的功能。
项目描述
Supermorecado
通过额外的命令扩展morecantile的功能。
文档: https://developmentseed.org/supermorecado/
源代码: https://github.com/developmentseed/supermorecado
supermorecado类似于supermercado,但支持其他TileMatrixSet网格。
安装
$ python -m pip install -U pip
$ python -m pip install supermorecado
# Or install from source:
$ python -m pip install -U pip
$ python -m pip install git+https://github.com/developmentseed/supermorecado.git
用法
supermorecado --help
Usage: supermorecado [OPTIONS] COMMAND [ARGS]...
Command line interface for the Supermorecado Python package.
Options:
--help Show this message and exit.
Commands:
burn Burn a stream of GeoJSONs into a output stream of the tiles they intersect for a given zoom.
edges For a stream of [<x>, <y>, <z>] tiles, return only those tiles that are on the edge.
heatmap Creates a vector `heatmap` of tile densities.
union Returns the unioned shape of a stream of [<x>, <y>, <z>] tiles in GeoJSON.
supermorecado burn
<{geojson} stream> | supermorecado burn <zoom> --identifier {tms Identifier} | <[x, y, z] stream>
接受GeoJSON输入流,并返回给定缩放级别的相交[x, y, z]
流。
使用默认TMS(WebMercatorQuad
)
cat tests/fixtures/france.geojson | supermorecado burn 9 | morecantile shapes | fio collect | geojsonio
使用其他TMS(例如WGS1984Quad
)
cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad | morecantile shapes --identifier WGS1984Quad | fio collect | geojsonio
supermorecado edges
<[x, y, z] stream> | supermorecado edges | <[x, y, z] stream>
输出代表输入流[x, y, z]
的边缘瓦片的[x, y, z]
流。边缘瓦片 = 任何与不存在瓦片直接相邻或与空瓦片对角相邻的瓦片。
cat tests/fixtures/france.geojson | supermorecado burn 9 | supermorecado edges | morecantile shapes | fio collect | geojsonio
supermorecado union
<[x, y, z] stream> | supermorecado union --identifier {tms Identifier} | <{geojson} stream>
从输入流 [x, y, z]
中输出合并的 GeoJSON 流。类似于 morecantile shapes
,但以整体足迹而不是每个瓦片的单个形状的形式。
使用默认TMS(WebMercatorQuad
)
cat tests/fixtures/france.geojson | supermorecado burn 9 | supermorecado union | fio collect | geojsonio
使用其他TMS(例如WGS1984Quad
)
cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad | supermorecado union --identifier WGS1984Quad | fio collect | geojsonio
supermorecado 热图
<[x, y, z] stream> | supermorecado heatmap --identifier {tms Identifier} | <{geojson} stream>
从输入流 [x, y, z]
中输出热图 GeoJSON 流。
使用默认TMS(WebMercatorQuad
)
cat tests/fixtures/heatmap.txt| supermorecado heatmap | fio collect | geojsonio
使用其他TMS(例如WGS1984Quad
)
# create a list of tiles
cat tests/fixtures/france.geojson | supermorecado burn 6 --identifier WGS1984Quad > france_wgs84_z6.txt
# randomly append more tiles
for run in {1..10}; do cat france_wgs84_z6.txt | sort -R | head -n 2 >> france_wgs84_z6.txt; done
cat france_wgs84_z6.txt | supermorecado heatmap --identifier WGS1984Quad | fio collect | geojsonio
API 迁移
supermorecado
实际上与 supermercado
非常相似(它重用了大部分代码),但增加了来自 morecantile 的多个 TMS 支持。
features = [
{
"geometry": {
"coordinates": [
[-127.97, 49.15],
[-101.95, -8.41],
[-43.24, -32.84],
[37.62, -25.17],
[71.72, -7.01],
[107.23, 48.69],
],
"type": "LineString",
},
"properties": {},
"type": "Feature",
},
]
# supermercado
from supermercado import burntiles, uniontiles
tiles = burntiles.burn(features)
u_tiles = uniontiles.union(features)
# supermorecado
import morecantile
from supermorecado import burnTiles, unionTiles
tms = morecantile.tms.get("WebMercatorQuad")
burntiles = burnTiles(tms=tms)
tiles = burntiles.burn(features)
uniontiles = unionTiles(tms=tms)
u_tiles = uniontiles.burn(features)
变更
请参阅 CHANGES.md。
贡献 & 开发
请参阅 CONTRIBUTING.md
许可协议
请参阅 LICENSE
作者
由 Development Seed 创建
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分发
supermorecado-0.1.2.tar.gz (12.2 kB 查看哈希值)
构建分发
supermorecado-0.1.2-py3-none-any.whl (14.5 kB 查看哈希值)