On Fri, 16 May 2014, Mahbubeh Parsaeian wrote:
Dear all
I have a shape file of UK. I have used it serveral times before. But now
when I want to use this shapefile the following error will apear.
shp-readShapePoly(GreaterLondon_ward)
Error in read.shape(filen = fn, verbose = verbose, repair = repair) :
File size and implied file size differ, consider trying repair=TRUE
shp-readShapePoly(GreaterLondon_ward, repair=TRUE)
Error in read.shape(filen = fn, verbose = verbose, repair = repair) :
Cannot repair file size error
If it is possible please let me know what is the problem.
The *.shx file is damaged, and is not showing the characteristics of a
regular bug as found in Geolytics shapefiles some ten years ago (see the
help file). Consequently, the shapefile cannot be read at all using
software that needs a correct or corrected *.shx to index the shapes. The
problem is that the pointers in *.shx to the shapes in *.shp do not match,
and may read past the end of the *.shp file; shape data read with
non-matching pointers will not be reliable anyway.
You should get the same error using rgdal::readOGR(); note that
maptools::readShape*() are not actively maintained and may be deprecated.
You need to re-source the shapefile, or ask your provider for a copy that
is not damaged. It used to be possible to use the shapefiles package to
read *.shp and *.dbf after deleting the offending *.shx; read.shp() and
read.dbf(), but putting this input into usable form is very hard.
Hope this clarifies,
Roger
Best
Mahboubeh
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: roger.biv...@nhh.no
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo