跳转到主要内容

围绕数字高程模型查询点的rasterio包装器

项目描述

demquery

Pypi Downloads Supported Python Versions

围绕数字高程模型查询点的rasterio包装器。

功能

  • 使用多个栅格文件,无需将它们合并到新文件中
  • 一次性查询多个点
  • 可选的二维插值(线性、三次或五次)
  • 通过读取所需的最小数据,性能合理

安装

我建议首先使用Conda安装依赖项,然后使用pip安装demquery本身。

conda install gdal rasterio numpy scipy -c conda-forge
pip install demquery

CLI脚本

> demquery --help
Usage: demquery [OPTIONS] FEATURES...

  Assign elevations to GeoJSON

Options:
  -d, --dem PATH          Paths to DEM files.  [required]
  -g, --dem-glob TEXT     Glob expression for DEM paths if folder is provided.
  -b, --band INTEGER      Band of rasters to use  [default: 1]
  -i, --interp-kind TEXT  either None, "linear", "cubic", or "quintic". None
                          will do no interpolation and choose the value in the
                          DEM closest to the provided point. linear creates a
                          3x3 grid and runs linear interpolation; cubic
                          creates a 5x5 grid and runs cubic interpolation;
                          quintic creates a 7x7 grid and runs quintic
                          interpolation.
  --help                  Show this message and exit.
echo \
    '{"type":"Feature","properties":{"name": "Glacier Peak"},"geometry":{"type":"Point","coordinates":[-121.2436843,48.0163834]}}' \
    | demquery -d /path/to/dem/files

输出

{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.243684, 48.016383, 1431.5755615234375]}, "properties": {"name": "Glacier Peak"}}]}

文档

from demquery import Query

dem_paths = ['dem1.tif', 'dem2.tif']
query = Query(dem_paths)

# Points must be in longitude, latitude order!
# These points are in Manhattan, not Antarctica
points = [(-73.985564, 40.757965), (-73.968520, 40.778912)]
elevations = query.query_points(points, interp_kind='linear')

数据下载

对于下载全球SRTM数据的优秀视觉工具,请查看以下网站

发布

要上传新版本到PyPI

python setup.py sdist
twine upload dist/demquery-0.3.0.tar.gz

变更日志

[0.3.1] - 2020-08-19

  • 无更改:尝试使conda-forge包正常工作

[0.3.0] - 2020-01-28

  • 添加CLI脚本

[0.2.1] - 2019-12-04

  • 将requirements.txt和requirements_dev.txt包含在清单包中

[0.2.0] - 2019-12-02

  • 修复虚拟栅格问题。

[0.1.0] - 2019-11-27

  • PyPI上的首次发布

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分布

demquery-0.3.1.tar.gz (11.4 kB 查看哈希值)

上传时间

由以下提供支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面