Error In Getinfo.shapefn
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn readshapepoly error more about Stack Overflow the company Business Learn more about hiring developers or posting error in readogr missing layer ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack error in .asspatialpolygonsshapes(map$shapes, ids, proj4string = proj4string, : not polygon shapes Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error when opening shapefile up vote 2 down vote favorite I
Could Not Find Function Readshapepoly
am trying to open a shapefile in R, but I am getting the following error message: Error in getinfo.shape(filen) : Error opening SHP file I have checked other responses and most problems seem to have been solved by ensuring that the .dbf and .shx files are in the same folder. I have them all in the same folder (along with some other extensions too) but I still get readshapepoly r the error message. I work on a mac. This is my code: getinfo.shape("/Users/Suz/Desktop/DWH satellite maps/20100517_Composite.shp") I have tried it without the .shp extension, and with other commands, such as readShapePoints etc. Nothing has worked so far. Please help, I am new to R and making maps, and after extensive Googling and forum-reading I am still stuck. r import shapefile share|improve this question edited Feb 6 '14 at 22:26 jbaums 15.6k43264 asked Feb 6 '14 at 21:29 user3281487 2717 Does readOGR("/Users/Suz/Desktop/DWH satellite maps", "20100517_Composite") work? (readOGR is in the rgdal package). –jbaums Feb 6 '14 at 21:32 Also, can you please include in your post the output of list.files('/Users/Suz/Desktop/DWH satellite maps')? Secondly, could you please try with a trusted shapefile, e.g. here. Finally, are you aware that getinfo.shape only reads the header of the shapefile, and doesn't actually read in the data - is that what you intended? –jbaums Feb 6 '14 at 22:24 I tried the shapefile that you suggested: getinfo.shape("/Users/Suz/Desktop/ne_110m_admin_1_states_provinces.shp") and still got the same error message. I am starting to think that my problem is something stupid and I don't have all the necessary libraries open or something..? I have sp, map tools, rgdal, and rg
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies readshapespatial of this site About Us Learn more about Stack Overflow the company
Readogr Shapefile
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Readogr Shapefile R
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://stackoverflow.com/questions/21614443/error-when-opening-shapefile minute: Sign up error using readShapeSpatial() up vote -1 down vote favorite I am trying to use the below code using maptool: stateShape <- readShapeSpatial("tl_2013_us_state") but i get an error: Error in getinfo.shape(fn) : Error opening SHP file my directory is correct r shapefile shp share|improve this question edited Oct 31 '14 at 6:01 Olli J 309216 asked Oct 30 '14 at http://stackoverflow.com/questions/26665437/error-using-readshapespatial 23:55 Pirates_say_R 1 1 Have you seen this post? –jazzurro Oct 31 '14 at 2:39 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote To read in spatial data you need the .shp, .shx, and .dbf files. You get the following behaviour if bits are missing: NO error if all there: > m=readShapeSpatial("metro") Let's remove the .dbf > file.remove("metro.dbf") [1] TRUE > m=readShapeSpatial("metro") Error in read.dbf(filen1) : unable to open DBF file Now without the .shx: > file.remove("metro.shx") [1] TRUE > m=readShapeSpatial("metro") Error in getinfo.shape(fn) : Error opening SHP file which looks like your error. Do you also have the corresponding .shx file? Shapefiles may also have a .prj file, but readShapeSpatial ignores this, which is why you shouldn't use it. ALWAYS use the rgdal package: > m = readOGR(".","metro") OGR data source with driver: ESRI Shapefile Source: ".", layer: "metro" with 5 features and 12 fields Feature type: wkbPolygon with 2 dimensions > summary(m) Object of class SpatialPolygonsDataFrame Coordinates: min max x -96.90567 -95.84013 y 40.99636 41.74546 Is projected: FALSE proj4string : [+proj=longlat +datum=WGS84 +no_defs +ellps=
in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Error opening SHP file (maptools) http://r.789695.n4.nabble.com/Error-opening-SHP-file-maptools-td849050.html I am having difficulty loading a points shapefile (1600 records) I http://r.789695.n4.nabble.com/Error-opening-SHP-file-td4716692.html generated from ArcGIS as a PointsSpatialDataFrame using the maptools readShapePoints function. library(maptools) surveypts <- readShapePoints(system.file("C:/temp/survey.shp", package="maptools")[1] Error in getinfo.shape(filen) : Error opening SHP file I've tried numerous re-exports and renames of the dataset, to no avail. I've also tried placing the shapefile in error in the library's shapefile folder, with the example dataset (see example below). x <- readShapePoints(system.file("shapes/survey.shp", package="maptools")[1] No luck there either. I'm quite new to R, but I can follow a manual and google well enough. However, I haven't seen anything to help me. The example point datasets load fine. I figure that I'm missing on some error in getinfo.shapefn familiarity with R and that I don't know the tricks yet. Any help? Thanks in advance. Gericke Cook USDA-APHIS-PPQ ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Paul Hiemstra Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error opening SHP file (maptools) [hidden email] schreef: > I am having difficulty loading a points shapefile (1600 records) I generated from ArcGIS as a PointsSpatialDataFrame using the maptools readShapePoints function. > > library(maptools) > surveypts <- readShapePoints(system.file("C:/temp/survey.shp", package="maptools")[1] > Error in getinfo.shape(filen) : Error opening SHP file > > I've tried numerous re-exports and renames of the dataset, to no avail. I've also tried placing the shapefile in the library's shapefile folder, with the example dataset (see example below). > > x <- readShapePoints(system.file("shapes/survey.shp", package="maptools")[1] > > No luck there either. I'm quite new to R, but I can follow a manual and
post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Error opening SHP file Any advice for the following errors? state.map <- readShapeSpatial("maps/st24_d00.shp") Error in getinfo.shape(fn) : Error opening SHP file [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Jim Lemon-4 Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error opening SHP file Hi Amoy, Another mystery question. I should have pursued parapsychology. That error statement is usually followed by one noting that the file specified cannot be found. Today's guess is that the R working directory: getwd() did not have a "maps" directory below it. Jim On Fri, Jan 22, 2016 at 11:39 AM, Amoy Yang via R-help <[hidden email] > wrote: > Any advice for the following errors? > state.map <- readShapeSpatial("maps/st24_d00.shp") > Error in getinfo.shape(fn) : Error opening SHP file > > [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. David Wins