首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在给定纬度和经度的情况下如何提取高于海平面的高度?

在给定纬度和经度的情况下如何提取高于海平面的高度?
EN

Stack Overflow用户
提问于 2021-07-04 01:59:53
回答 2查看 428关注 0票数 0

我正在尝试提取数据中给定的一组lats和lats的高度数据。我试图查找一些较旧的答案(从9-10年前开始),..but中的许多方法已经过时,或者这些函数无法工作。有什么新建议吗?

代码语言:javascript
复制
lat <- c(45.08323,40.08323)
long <- c(-82.46797,-81.46797)
df <- data.frame(lat, long)

我曾尝试过以下建议:

  1. 使用geonames包,并从srtm3数字高程模型中获取值

我遇到了这样的错误:Error in url(url, open = "r") : cannot open the connection to 'http://api.geonames.org/srtm3JSON?lat=NA&lng=NA&

  1. 我试着按照链接答案中的建议使用googleway海拔起搏

如果是最新的R> 4.0版本,升级包将不会下载。

代码语言:javascript
复制
I get an error that says   Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually. 

当我尝试安装所需的软件包时:

“这个版本的R不提供‘libudunits2’软件包”

###EDIT:什么起作用了?

代码语言:javascript
复制
library(geonames)
readLines(url("http://api.geonames.org/",open="r"))
options(geonamesUsername= "MyUsername") #Note you have to create a username one the website AND enable webservices on your geonames user account at https://www.geonames.org/manageaccount. 

GNsrtm3(54.481084,-3.220625)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-07-04 03:00:26

这成功地得到了第二点,但没有得到第一点。

代码语言:javascript
复制
library(elevatr)
library(rgdal)
lat <- c(45.08323,40.08323)
long <- c(-82.46797,-81.46797)
df <- data.frame(long, lat)
get_elev_point(df, prj="EPSG:4326")
# Note: Elevation units are in &units=Meters 
# Note:. The coordinate reference system is:
#  GEOGCRS["WGS 84 (with axis order normalized for visualization)",
#     DATUM["World Geodetic System 1984",
#         ELLIPSOID["WGS 84",6378137,298.257223563,
#             LENGTHUNIT["metre",1]]],
#     PRIMEM["Greenwich",0,
#         ANGLEUNIT["degree",0.0174532925199433]],
#     CS[ellipsoidal,2],
#         AXIS["geodetic longitude (Lon)",east,
#             ORDER[1],
#             ANGLEUNIT["degree",0.0174532925199433,
#                 ID["EPSG",9122]]],
#         AXIS["geodetic latitude (Lat)",north,
#             ORDER[2],
#             ANGLEUNIT["degree",0.0174532925199433,
#                 ID["EPSG",9122]]]]
#             coordinates elevation elev_units
# 1 (-82.46797, 45.08323)        NA     meters
# 2 (-81.46797, 40.08323)    271.82     meters
票数 2
EN

Stack Overflow用户

发布于 2021-07-04 04:06:49

需要在https://www.geonames.org/manageaccount上创建用户名并启用webservice

代码语言:javascript
复制
    library(geonames)
    readLines(url("http://api.geonames.org/",open="r"))
    options(geonamesUsername= "MyUsername") #Note you have to create a username one the website AND enable webservices on your geonames user account at https://www.geonames.org/manageaccount. 
    
    GNsrtm3(54.481084,-3.220625)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68241139

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档