Skip to content
Prev 24692 / 29559 Next

Country names from coordinates

Here is an approach using raster::extract(). I assume your point 
locations are unprojected.

library(raster)
library(tmap)

data(World)
proj4string(World)
# [1] "+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 
+units=m +no_defs +towgs84=0,0,0"

pts <- SpatialPointsDataFrame(temp [, c(1,2)], temp, 
proj4string=CRS("+init=epsg:4326"))
# Reproject World
World <- spTransform(World, CRS("+init=epsg:4326"))
# Extract and append World attributes at pts point locations
pts <- extract(World, pts, sp=TRUE)

--Mel.
On 7/25/2016 9:01 AM, Miluji Sb wrote: