## http://www.geonames.org/login 上注册账号,并开通免费网页权限,且不要在内网
##使用geonames API 和R语言
install.packages(c("here","sp","rgbif"))
library(rgbif)
library(here)
library(sp)
## 文件头行名: Latitude Longitude
geo=read.csv("input.csv",header=T)
geo=subset(geo,!is.na(Latitude))
head(geo)
#xxx 为你的账号
options(geonamesUsername = "xxx")
#file.edit(here::here(".Rprofile"))
user <- "xxx"
lats <- geo$Latitude
lons <- geo$Longitude
#srtm1=30m*30m,最高分辨率。
ele=elevation(latitude = lats, longitude = lons, elevation_model = "srtm1",username = user)
write.csv(ele, "output.csv")