Hi,
I'm trying to plot some maps. I've downloaded some shapefiles but cannot read them with "readOGR" function.
I've installed "libdgal" and "libproj-dev".
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev
But when using:
library(rgdal) # R wrapper around GDAL/OGR
library(ggplot2) # for general plotting
library(ggmap) # for fortifying shapefiles
# First read in the shapefile, using the path to the shapefile and the shapefile name minus the
# extension as arguments
shapefile <- readOGR("/home/ogonzales/Escritorio/maps_in_r/", "BAS_LIM_DEPARTAMENTO")
I get this error:
Error in readOGR("/home/ogonzales/Escritorio/maps_in_r/", "BAS_LIM_DEPARTAMENTO") :
no features found
Además: Warning message:
In ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
ogrInfo: all features NULL
This is the message I get after loading "rgdal" package:
library(rgdal) # R wrapper around GDAL/OGR
Loading required package: sp
rgdal: version: 1.3-2, (SVN revision 755)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
Path to GDAL shared files: /usr/share/gdal/2.2
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-7
Path of file:
The file's path is correct:
list.files('/home/ogonzales/Escritorio/maps_in_r/', pattern='\\.shp$') #"BAS_LIM_DEPARTAMENTO.shp"
file.exists('/home/ogonzales/Escritorio/maps_in_r/BAS_LIM_DEPARTAMENTO.shp') #TRUE