Search code examples
rpackageshapefilecran

How to convert from shape into polygon in R? There was shape2poly(shapefiles) but this function have been removed


How to convert from shape into polygon in R? There was shape2poly(shapefiles) but this function have been removed, are shapefiles, maptools, spdep still packages for handling maps in R?


Solution

  • I tend to use the OGR stuff, as it lets me work with data from a range of sources (geodatabases, kml, etc).

    library(rgdal)
    mylayer <- readOGR(dsn="/path/to/folder/containing/shapefile",
                       layer="shapefilename-minus-dot-shp")