4

I am trying to execute the readOGR function for a shapefile but it is taking way too long to process and I end up killing the process after 20mins or so. Following is the code:

country <- readOGR('shapeFiles','gadm28', encoding = 'UTF-8')

The execution hangs after printing the following lines:

OGR data source with driver: ESRI Shapefile 
Source: "shapeFiles", layer: "gadm28"
with 255272 features
It has 61 fields

I am working on Windows 7 with 8GB RAM, using RStudio. Any suggestions on what I could change to get it running quick?

Karsten W.
  • 17,826
  • 11
  • 69
  • 103
user2330778
  • 235
  • 1
  • 4
  • 11

1 Answers1

1

How big is your shape? Some large shape can take forever to load in R. I think waiting 20 minutes isn't long enough.

My suggestion, call it before lunch, wait. Then when it succeed, save your object into a RDATA.

save(country, file="country.rdata")

Loading the RDATA is faster than the shp itself.

Bastien
  • 3,007
  • 20
  • 38