Skip to content

Instantly share code, notes, and snippets.

@kpq
Last active December 18, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpq/5864255 to your computer and use it in GitHub Desktop.
Save kpq/5864255 to your computer and use it in GitHub Desktop.
How to plot points and shapes in R, bc I always forget the reprojecting stuff
library(rgdal)
# a clean data frame called d2
maptest <- d2
coordinates(maptest) <- c("lng", "lat")
proj4string(maptest) <- CRS("+proj=longlat")
ogrInfo(dsn = "shapes", "County")
proj4string(shapes) <- "+proj=utm +zone=18 +datum=NAD83 +units=m +no_defs "
new_shapes <- spTransform(shapes, CRS("+proj=longlat"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment