Convert lat/lon to zipcode / neighborhood name

前端 未结 5 679
春和景丽
春和景丽 2020-12-31 22:54

I have a large collection of pictures with GPS locations, encoded as lat/lon coordinates, mostly in Los Angeles. I would like to convert these to (1) zipcodes, and (2) neigh

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 23:06

    You can now do this directly within R itself thanks to the rather awesome ggmap package.

    Like others mention, you'll be reverse geocoding using the google maps API (and therefore limited to 2,500 queries daily), but it's as simple as:

    library("ggmap")
    
    # generate a single example address
    lonlat_sample <- as.numeric(geocode("the hollyood bowl"))
    lonlat_sample  # note the order is longitude, latitiude
    
    res <- revgeocode(lonlat_sample, output="more")
    # can then access zip and neighborhood where populated
    res$postal_code
    res$neighborhood
    

提交回复
热议问题