[R-sig-Geo] error in readShapePoly

Roger Bivand Roger.Bivand at nhh.no
Wed Jun 10 15:37:47 CEST 2009


On Wed, 10 Jun 2009, Hurlbert, Allen H. (Biology) wrote:

> Hello list,
>
>
>
> I'm new to GIS in R, so I appreciate any pointers with my problem.
>
>
>
> I have code that uses readShapePoly to read in shapefiles in a loop and
> does some basic operations. This code appeared to be working great for
> twenty or so files, but then on one shapefile bonked with the following
> error:   Error in from[j]:to[j] : NA/NaN argument.
>
>
>
> The problem shapefile opens fine in ArcGIS and there is nothing readily
> different about its attribute table or source information that I can see
> (and furthermore, all shapefiles are from the same standardized source,
> although of course that doesn't mean one of them didn't get messed up
> somewhere along the way). I am running 2.7.2 on Windows XP x64.
>

Could you 1) try readOGR() in rgdal instead of readShapePoly() in maptools 
if possible, and see if the problem is repeated; 2) post either the output 
of traceback() run immediately after the error occurs (will show where, 
more or less, the problem is in code) here and/or the shapefile(s) all 3-4 
files in a zip archive on a website and post the URL here so that others 
can debug this? The problem seems to be a shot Pstart vector putting an 
invalid value into the range from which to extract ring coordinates, but 
the question is why it is shot.

If you can say something about the origin of the file, this may also help 
(what software wrote it), some have broken *.shx files.

Roger

>
>
> Thanks in advance,
>
> Allen
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list