Conversion for latitude/longitude to altitude in R

前端 未结 4 1081
野趣味
野趣味 2021-02-06 02:44

Does anyone know if there is a tool in R to find the height above sea level of a location, given the latitude and longitude ?

4条回答
  •  孤城傲影
    2021-02-06 03:29

    You can access elevation data through Google Maps Elevation API. And in R you can use this through my googleway package

    To use Google Maps API you need an API key

    library(googleway)
    
    api_key <- "your_api_key"
    
    df_locations <- data.frame(lat = c(54.481084), lon = c(-3.220625))
    
    google_elevation(df_locations = df_locations, key = api_key)
    
    # $results
    # elevation location.lat location.lng resolution
    # 1  813.9291     54.48108    -3.220625   610.8129
    # 
    # $status
    # [1] "OK"
    

提交回复
热议问题