1

I am trying to read a poly-line shapefile in R 3.2.2 using maptools (I can't install rgdal because of company firewalls) but I come up with the following error:

Error in read.shape(filen = fn, verbose = verbose, repair = repair) : File size and implied file size differ, consider trying repair=TRUE

Setting repair=T, does not solve the problem, so I tried the following fix:

require(shapefiles)
p_shp <- read.shp('myfile.shp')
simple_pshp <- convert.to.simple(p_shp)
p_dbf <- read.dbf('myfile.dbf')
simple_pshp <- change.id(simple_pshp, p_dbf$dbf$id)
pipes <- convert.to.shapefile(simple_pshp, data.frame(id=p_dbf$dbf$id,asset_id=p_dbf$dbf$asset_id), 'id', 3)

It makes sense to me but I can't find anyone else suggesting this as a fix for this problem so I'm not sure that I can trust it. Can you see anything wrong with this and, if so, can you suggest a better alternative?

Thank you

ogg
  • 23
  • 5

0 Answers0