用python编写的现代xyz tile服务器
terracotta的Python项目详细描述
terracotta是一个纯python tile服务器,在 专用Web服务器或作为AWS Lambda上的无服务器应用程序。它是建立在 现代Python3.6堆栈,由优秀的开源软件如 Flask,Zappa, 以及Rasterio。
Try the demo| Read the docs| Explore the API| Satlas, powered by Terracotta
为什么是兵马俑?
- 开始是件小事。有一个装满了
cloud-optimized GeoTiffs在不同的
您想在浏览器中查看的投影?
terracotta serve -p {name}.tif
和terracotta connect localhost:5000
带你去。 - 我们对您的数据做了最低限度的假设,因此您将继续负责。 继续使用你知道并喜欢的工具来创建和组织你的 资料图,兵马俑正是如此。
- 无服务器部署是第一优先级用例,因此您没有 担心维护或扩展架构。
- terracotta实例是自记录的。一切都在前端 需要了解您的数据,只需从 API终结点。
陶土工作流程
一。优化光栅文件
$ ls -lh total 1.4G -rw-r--r-- 1 dimh 1049089 231M Aug 2916:45 S2A_20160724_135032_27XVB_B02.tif -rw-r--r-- 1 dimh 1049089 231M Aug 2916:45 S2A_20160724_135032_27XVB_B03.tif -rw-r--r-- 1 dimh 1049089 231M Aug 2916:46 S2A_20160724_135032_27XVB_B04.tif -rw-r--r-- 1 dimh 1049089 231M Aug 2916:56 S2A_20170831_171901_25XEL_B02.tif -rw-r--r-- 1 dimh 1049089 231M Aug 2916:57 S2A_20170831_171901_25XEL_B03.tif -rw-r--r-- 1 dimh 1049089 231M Aug 2916:57 S2A_20170831_171901_25XEL_B04.tif $ terracotta optimize-rasters *.tif -o optimized/ Optimizing rasters: 100%|██████████████████████████|[05:16<00:00, file=S2A_20170831_...25XEL_B04.tif]
2.从文件名模式创建数据库
$ terracotta ingest S2A_{date}_{}_{tile}_{band}.tif -o greenland.sqlite Ingesting raster files: 100%|███████████████████████████████████████████|6/6 [00:49<00:00, 8.54s/it]
三。上菜
$ terracotta serve -d greenland.sqlite * Serving Flask app "terracotta.server"(lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: off * Running on http://localhost:5000/ (Press CTRL+C to quit)
四。浏览正在运行的服务器
手动
$ curl localhost:5000/datasets?tile=25XEL {"page":0,"limit":100,"datasets":[{"date":"20170831","tile":"25XEL","band":"B02"},{"date":"20170831","tile":"25XEL","band":"B03"},{"date":"20170831","tile":"25XEL","band":"B04"}]}
交互式
$ terracotta connect localhost:5000 * Serving Flask app "terracotta.client"(lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5100/ (Press CTRL+C to quit)
开发
我们乐意接受bug reports
以及pull requests通过github。
为了使代码有用,请确保测试覆盖了它,并且
它满足我们的绒线实践(通过mypy
和flake8
)。
要运行测试,只需通过
$ pip install -e .[test]
然后,您可以运行
$ pytest
从存储库的根目录。