Search code examples
rdataframegisshapefile

Differences between readOGR and st_read


I am starting to work with R and shapefiles, I have seen that there are two ways to load a shapefile, readOGR and st_read....could you please explain to me what is the difference between both methods and which one is more recommended to work in GIS?

thanks in advance. PD: I am a beginner in R, usually i work with arcGis or QGis.


Solution

  • this depends on whether you would like to work with sf or sp (I recommend the former). Both functions read in shapefiles, but st_read reads them as class sf and readOGR from rgdal reads them as sp.

    I recommend reading up on sf, and using it instead of sp, but then again, it certainly depends on what you want to do.