Created
October 27, 2016 00:51
-
-
Save mdsumner/e081c0f843e4ba8a005351641bd256fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
library(rgdal) | |
data(meuse) | |
listcoords <- lapply(split(meuse, meuse$landuse), function(x) cbind(x$x, x$y)) | |
spmdf <- SpatialMultiPointsDataFrame(listcoords, data.frame(name = names(listcoords), count = sapply(listcoords, nrow), stringsAsFactors = FALSE)) | |
proj4string(spmdf ) <- CRS("+init=epsg:28992") | |
## there are 15 features with differing numbers of coordinates each | |
#plot(spmdf, col = viridis::viridis(length(spmdf))) | |
writeOGR(spmdf, ".", "spmdf", "ESRI Shapefile") | |
## or for the righteous and good | |
#writeOGR(spmdf, "spmdf.gpkg", "spmdf", "GPKG") | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment