【问题标题】:How to find city and state from the latitude and longitude in R [closed]如何从R中的纬度和经度中找到城市和州[关闭]
【发布时间】:2016-02-18 12:36:26
【问题描述】:

我有一个包含纬度和经度的文件。我需要为此获取城市和州信息。如何在 R 中执行此操作。为此使用哪个库。

谢谢

【问题讨论】:

    标签: r geolocation latitude-longitude


    【解决方案1】:

    您可以使用revgeocode() 中的ggmap

    如果您还指定 output 参数并将其设置为 "more",则该函数会返回一个不错的数据框,其中包含有关各个城市和州的信息。

    示例:

    library(ggmap)
    geo_information <- revgeocode(c(-97.358112, 37.683829), output = "more")
    
    geo_information$locality
    # [1] Wichita
    # Levels: Wichita
    
    geo_information$administrative_area_level_1
    # [1] Kansas
    # Levels: Kansas
    

    【讨论】:

    • 这在我的ggmap(版本3.0.0)中不再有效。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-04
    • 2021-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多