Skip to content
Prev 24693 / 29559 Next

Country names from coordinates

On Mon, 25 Jul 2016, Bacou, Melanie wrote:

            
Offline, OK, but online you may use the geonames package, which requires a 
valid geonames user name:

library(geonames)
options(geonamesUsername="<me>")
res <- vector(mode="list", length=nrow(ptsDF))
for (i in 1:nrow(ptsDF)) res[[i]] <- try(GNcountryCode(ptsDF$latitude[i],
  ptsDF$longitude[i], radius=50))
res

using radius= to catch a slightly offshore point in Chile in the example.

Roger