-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot open data source #673
Comments
|
Are the other files in the same directory (same name, extensions .prj, .shp, .dbf, .shx)? |
Hi @edzer thanks for follow-up, yes they are:
🤔 maybe there's a file in there that is throwing it off (having a sudden flashback). FWIW, using a GeoJSON yielded the same error. |
More info:
|
The file you're linking to with system.file is not part of sf.
should work. |
@tim-salabim whoa! That was it. I was originally expecting that, but I was blindly following guides here: https://r-spatial.github.io/sf/articles/sf2.html#using-st_read. library(sf)
## Loading required package: methods
## Linking to GEOS 3.5.1, GDAL 2.2.1, proj.4 4.9.3
fname <- system.file("shape/nc.shp", package="sf")
fname
## [1] "/home/edzer/R/x86_64-pc-linux-gnu-library/3.4/sf/shape/nc.shp"
nc <- st_read(fname)
## Reading layer `nc' from data source `/home/edzer/R/x86_64-pc-linux-gnu-library/3.4/sf/shape/nc.shp' using driver `ESRI Shapefile'
## Simple feature collection with 100 features and 14 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
## epsg (SRID): 4267
## proj4string: +proj=longlat +datum=NAD27 +no_defs
Not sure I follow. This is a much better API though! Thanks everyone :) |
OH. I think I understand now. That is looking for an example shapefile within the package. Thanks again! |
nc.shp is an example file that ships with the package. As such we need |
I have got the same problem. |
I want to read a Shapefile so I can do some analysis on it. This seems like an OGR problem, but I'm not sure how to troubleshoot.
I'm on MacOS.
Error:
Code:
Is there a way to test whether the other global dependencies like GDAL are set up correctly?
The text was updated successfully, but these errors were encountered: