Read shape file with readOGR verses readShapePoly

For anyone ending up here with this error on a Linux box, I found the problem was using a home path shortcut. i.e.

# Works
readOGR(dsn="/home/user/dir", layer="file")

# Doesn't work
readOGR(dsn="~/dir", layer="file")

I have no idea why.


I used the file ne_110m_land

Try with this:

setwd('D:/JMSR/codes.R/mapas')
unzip("ne_110m_land.zip")
ogrInfo(".", "ne_110m_land")
wmap <- readOGR(".", "ne_110m_land")

Try to remove your last '/' from file path.

readOGR(dsn = 'c:/users/mark w miller/gis_in_R/shapefile_example',
        layer = 'orcounty')

Tags:

R

Shapefile

Rgdal