In my macOS system RStudio, plotting spatial data (statialpolygons, points and lines) is extremely slow, making it impossible to work with.
When I try to plot the shapefile in this link (@https://drive.google.com/drive/folders/0B0XRH7FN95-RSzFRckhXNjVWYlk), it takes about 30 minutes in RStudio. If I plot in R (outside RStudio), it takes about 20 minutes to print in an external plotting windows titled Quartz2. On the contrary, it is a couple of less than a minute in a window's machine in my lab with equivalent specs.
The best workaround I know is to use a pdf as plotting device (or png). Doing that, it takes just a couple of seconds.
shp <- readOGR("~/stof_shp", "AP_PAT_edited1") pdf() plot(shp) dev.off()
But it is not a satisfactory solution. I love work with spatial data on R, but the biggest inconvenient is the difficulty for visualizing the data, and this makes it much harder.
I have talked with different people that are in my same situation, but there doesn't seem to be too much information about it when you google or search in gis.stackexchange. I have doubts on whether it affects all macOS systems, or only laptops, only some version of the OS or all of them. My system and applications are updated.
sessionInfo() R version 3.4.0 (2017-04-21) Platform: x86_64-apple-darwin16.6.0 (64-bit) Running under: macOS Sierra 10.12.5
At some point, I thought it was the matter of my version of
proj, but I am confident now that I have the latests set and working. I have
> library(rgdal) Loading required package: sp rgdal: version: 1.2-8, (SVN revision 663) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01 Path to GDAL shared files: /opt/local/share/gdal Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] Path to PROJ.4 shared files: (autodetected) Linking to sp version: 1.2-5
I have also been messing with XQuartz and X11, getting nowhere (I wouldn't know how to get the info of which versions I have installed, but if I enter
X11() on RStudio, it will try to start X11, but it will crash in an infinite loop that I have been unable to fix).
I started the question in stackoverflow, but I was told to post the question here, where it belongs better. Few months ago I made similar question here, but I did not reproduce the example data and I think that I might have been missleading in how I presented the problem (@Slow plotting SpatialPolygonDataFrames on some systems). For those reasons I am starting a new question.