我正试图从存储在.HGT文件中的NASA读取高程数据到R中。我已经检查了rgdal
库,但显然它没有读取这种类型的文件。
ps。Stack Overflow社区展示了如何在Python和C ++中读取这种类型的文件,但是我一直在寻找纯R解决方案。
2014年,由NASA的航天飞机雷达地形任务(SRTM)生成的地形数据已在全球范围内发布。美国境外地区的SRTM数据分辨率为1弧秒,或大约30米(98英尺)。您可以在此处阅读更多信息并在此处下载数据。
这是来自www2.jpl.nasa.gov/srtm/faq.html的描述:
SRTM数据文件的名称类似“ N34W119.hgt”。字母和数字代表什么,“。hgt”格式是什么?
Each data file covers a one-degree-of-latitude by one-degree-of-longitude block of Earth's surface. The first seven characters indicate the southwest corner of the block, with N, S, E, and W referring to north, south, east, and west. Thus, the "N34W119.hgt" file covers latitudes 34 to 35 North and longitudes 118-119 West (this file includes downtown Los Angeles, California). The filename extension ".hgt" simply stands for the word "height", meaning elevation. It is NOT a format type. These files are in "raw" format (no headers and not compressed), 16-bit signed integers, elevation measured in meters above sea level, in a "geographic" (latitude and longitude array) projection, with data voids indicated by -32768. International 3-arc-second files have 1201 columns and 1201 rows of data, with a total filesize of 2,884,802 bytes ( = 1201 x 1201 x 2). United States 1-arc-second files have 3601 columns and 3601 rows of data, with a total filesize of 25,934,402 bytes ( = 3601 x 3601 x 2). For more information read the text file "SRTM_Topo.txt" at http://edcftp.cr.usgs.gov/pub/data/srtm/Readme.html
使用该raster
软件包的答案非常简单(由于@Pascal和@hrbrmstr的注释)。该rgdal
软件包也必须安装。
# Load libraries
library(raster)
library(rgdal)
# read file
elevation <- raster("S23W044.hgt")
# view image
image(elevation)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句