powered by
Map GPS points to polygon regions
mapPoints(data, geo, long, lat, names)
Spatial djacency matrix.
point data with two columns of GPS locations.
SpatialPolygonsDataFrame of the map
column name for longitudinal coordinate in the data
column name for latitude coordinate in the data
character vector of region ids to be added to the neighbours list
Zehang Richard Li
data(DemoMap) dat <- data.frame(ID = c(1,2,3), lon = c(32.2, 33.7, 33), lat = c(0.1, 0.9, 2.8)) dat2 <- mapPoints(dat, DemoMap$geo, long = "lon", lat = "lat", names = "REGNAME") dat2
Run the code above in your browser using DataLab