r - readOGR() cannot open file -
wmap <- readogr(dsn="~/r/funwithr/data/ne_110m_land", layer="ne_110m_land")
this code not loading shape file , error generated as
error in ogrinfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : cannot open file
i sure directory correct one. @ end / not there , layer name correct.
inside ne_110m_land directory files have are: ne_110m_land.dbf,ne_110m_land.prj,ne_110m_land.shp,ne_110m_land.shx,ne_110m_land.version.txt,ne_110m_land.readme.html
you have shown have right path with:
list.files('~/r/funwithr/data/ne_110m_land', pattern='\\.shp$') file.exists('~/r/funwithr/data/ne_110m_land/ne_110m_land.shp')
perhaps try:
readogr(dsn=path.expand("~/r/funwithr/data/ne_110m_land"), layer="ne_110m_land")
or simpler alternative wrapped around that:
library(raster) s <- shapefile("~/r/funwithr/data/ne_110m_land/ne_110m_land.shp")
Comments
Post a Comment