Skip to content

Match Coordinates to NUTS 2 ID

3 messages · Miluji Sb, MacQueen, Don

#
Dear all,


I have downloaded the NUTS 2 level data from
library(?rgdal?)
library(?RColorBrewer?)
library(?classInt?)
#library(?SmarterPoland?)
library(fields)

# Download Administrative Level data from EuroStat
temp <- tempfile(fileext = ".zip")
download.file("
http://ec.europa.eu/eurostat/cache/GISCO/geodatafiles/NUTS_2010_60M_SH.zip
",
              temp)
unzip(temp)

# Read data
EU_NUTS <- readOGR(dsn = "./NUTS_2010_60M_SH/data", layer =
"NUTS_RG_60M_2010")

# Subset NUTS 2 level data
map_nuts2 <- subset(EU_NUTS, STAT_LEVL_ == 2)

I also have data for a variable by coordinates, which looks like this:

structure(list(LON = c(-125.25, -124.75, -124.25, -124.25, -124.25,
-124.25), LAT = c(49.75, 49.25, 42.75, 43.25, 48.75, 49.25),
    yr = c(2.91457704560515, 9.94774197180345, -2.71956412885765,
    -0.466213169185147, -36.6645659563374, 10.5168056769535)), .Names =
c("LON",
"LAT", "yr"), row.names = c(NA, 6L), class = "data.frame")

I would like to match the coordinates to their corresponding NUTS 2 region
- is this possible? Any help will be high appreciated. Thank you!

Sincerely,

Milu
#
Perhaps the
  over()
function in the sp package.

(in which case, R-sig-geo might be a better place to ask).

-Don
#
Thank you for your reply. I am trying to use the over function - but having
trouble. Asked at R-sig-geo. Thanks again!

Sincerely,

Milu
On Fri, May 27, 2016 at 12:49 AM, MacQueen, Don <macqueen1 at llnl.gov> wrote: