Skip to content

Instantly share code, notes, and snippets.

@jlehtoma
Created September 10, 2013 07:16
Show Gist options
  • Save jlehtoma/6505993 to your computer and use it in GitHub Desktop.
Save jlehtoma/6505993 to your computer and use it in GitHub Desktop.
Example of how 2 sets of coordinates (in the same projection) can be compared for proximity.
# Buffer the coordinates with a desired distance
sp.espoo.etrs89.buffer <- gBuffer(sp.espoo.etrs89, byid=TRUE, width=100)
sp.espoo.etrs89.buffer <- SpatialPolygonsDataFrame(sp.espoo.etrs89.buffer,
sp.espoo.etrs89@data)
sp.tarto.etrs89.buffer <- gBuffer(sp.tarto.etrs89, byid=TRUE, width=100)
sp.tarto.etrs89.buffer <- SpatialPolygonsDataFrame(sp.tarto.etrs89.buffer,
sp.tarto.etrs89@data)
# See which SpatialPoints from the KML files fall within the buffer from sp
# points
espoo.buffers.with.kml.point <- sp::over(kml.espoo.etrs89, sp.espoo.etrs89.buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment