python脚本下载全球地形数字高程模型,srtm 30m dem和srtm90mdem。

elevation的Python项目详细描述


全球地理高程数据变得简单。 Elevation提供了全局数据集的轻松下载、缓存和访问 SRTM 30m Global 1 arc second V003 由nasa和nga在Amazon S3主持 和 SRTM 90m Digital Elevation Database v4.1 由CGIAR-CSI详细说明。

请注意,适用于各个提供商的任何下载策略。

安装

安装latest version of Elevation 从python包索引:

$ pip install elevation

需要安装并运行以下依赖项:

以下命令运行一些基本检查并报告常见问题:

$ eio selfcheck
Your system is ready.

gnu make、curl和unzip预安装在大多数操作系统中。 安装gdal命令行工具的最佳方法因操作系统而异 以及分配,请参考 GDAL install documentation

命令行用法

确定感兴趣区域的地理边界,并使用eio命令获取dem。 例如,将罗马的srtm 30m dem(约41.9n12.5e)剪辑到Rome-30m-DEM.tif文件:

$ eio clip -o Rome-30m-DEM.tif --bounds 12.35 41.8 12.65 42

对于SRTM 90M DEM,请使用:

$ eio --product SRTM3 clip -o Rome-90m-DEM.tif --bounds 12.35 41.8 12.65 42

--bounds选项接受经纬度坐标 (在WGS84参考系统EPSG:4326的大地坐标系中,更精确地说是那些关心的人) 给定为left bottom right top,类似于rio命令表单rasterio

如果您已经安装了软件包rasteriofiona 您可以在gdal和ogr支持的任何其他地理空间数据源的相同范围上剪裁dem, 例如,如果您有一个地理参考图像MyImage.tif,则可以使用以下命令剪裁相应的dem:

$ eio clip -o MyImage-DEM.tif --reference MyImage.tif  # enable with: $ pip install rasterio

--reference选项还可以将verctor数据作为输入:

$ eio clip -o MyShapefile-DEM.tif --reference MyShapefile.shp  # enable with: $ pip install fiona

第一次访问某个区域时,Elevation从USGS或CGIAR-CSI服务器下载数据块,然后 以geotiff压缩格式缓存它们, 随后进入相同和附近地区的速度要快得多。

clip子命令不允许自动下载大量dem磁贴, 请参考上游供应商的网站了解批量下载的首选过程。

要清除过时的临时文件并在发生服务器错误时修复缓存,请使用:

$ eio clean

命令行参考

eio命令作为以下子命令和选项:

$ Usage: eio [OPTIONS] COMMAND [ARGS]...

Options:
  --version                Show the version and exit.
  --product [SRTM1|SRTM3]  DEM product choice.  [default: SRTM1]
  --cache_dir DIRECTORY    Root of the DEM cache folder.  [default:
                           /Users/amici/Library/Caches/elevation]
  --help                   Show this message and exit.

Commands:
  clean      Clean up the product cache from temporary files.
  clip       Clip the DEM to given bounds.
  distclean  Remove the product cache entirely.
  info       Show info about the product cache.
  seed       Seed the DEM to given bounds.
  selfcheck  Audit the system for common issues.

clip子命令:

$ eio clip --help
Usage: eio clip [OPTIONS]

Options:
  -o, --output PATH     Path to output file. Existing files will be
                        overwritten.  [default: out.tif]
  --bounds FLOAT...     Output bounds in 'left bottom right top' order.
  -m, --margin TEXT     Decimal degree margin added to the bounds. Use '%' for
                        percent margin.  [default: 0]
  -r, --reference TEXT  Use the extent of a reference GDAL/OGR data source as
                        output bounds.
  --help                Show this message and exit.

可以通过设置前缀为EIO的环境变量来定义默认值, 例如EIO_PRODUCT=SRTM3EIO_CLIP_MARGIN=10%

python api

每个命令在elevation模块中都有相应的api函数:

>>> import elevation
>>> # clip the SRTM1 30m DEM of Rome and save it to Rome-DEM.tif
>>> elevation.clip(bounds=(12.35, 41.8, 12.65, 42), output='Rome-DEM.tif')
>>> # clean up stale temporary files and fix the cache in the event of a server error
>>> elevation.clean()

贡献

我们非常欢迎您的贡献。请参阅CONTRIBUTING文档 最好的帮助方式。 如果您遇到任何问题,请提交一个问题与详细说明。

作者:

许可证

Elevation是免费的开源软件 根据Apache License, Version 2.0条款分发。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java语义理解递归反向字符串返回语句   java toString()方法打印空值   java大型IN子句   如何使用JavaSpring在JavaScriptjQuery中设置post路径   java ByteArrayOutputStream已上载到服务器   java为什么轮询在SocketIO上获取数据“无法加载请求的项”?   java源代码应该以UTF8格式保存   Java数据库轮询器?   在Java中将double转换为float   java AccessDeniedException:C:\Windows\System32\drivers\etc\hosts