[R] vector file

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun May 1 09:50:05 CEST 2011


On Sun, May 1, 2011 at 8:08 AM, azam jaafari <azamjaafari at yahoo.com> wrote:
> Dear All
>
> I want to import the vector file (   .shp) to R. I could import the file by rgdal package before, by following:
>
> geology<-readOGR('C:/geology//saga/geo.geom','finalgeology')
>
> but now there is an error:
>
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding = input_field_name_encoding) :
>
>         GDAL Error 4: .shx file is unreadable, or corrupt.
>
> Can you tell me where is the problem.

 I would say that the .shx file is unreadable, or corrupt.

Do you even have a .shx file? For every .shp file, there should be a
.shx file, and a .dbf file. .shp files on their own are useless - you
will need at least finalgeology.shp, finalgeology.shx and
finalgeology.dbf. There may also be a finalgeology.prj with the
projection info.

 We don't know what's changed between when you said it worked and now,
so we can't really tell. The only clue is the error about the .shx
file - so check you still have the .shx file and you didnt delete it.

Barry



More information about the R-help mailing list