- How does R plot maps?
- What is a straight line, anyway?
- Large spatial datasets with R
- Lifecycle of R Spatial packages
- R Spatial community
Slides: https://edzer.github.io/UseR2021/
R Markdown at: https://github.com/edzer/UseR2021
UseR! 2021: Jul 5, 2021, 15:30 UTC
Slides: https://edzer.github.io/UseR2021/
R Markdown at: https://github.com/edzer/UseR2021
… any two-dimensional plot of Earth-bound surface data involves projection
plot(map)
maps::map("world") maps::map("usa")
?map projection: character string that names a map projection to use. See ‘mapproject’ (in the ‘mapproj’ library). The default is to use a rectangular projection with the aspect ratio chosen so that longitude and latitude scales are equivalent at the center of the picture.
For simple features, some definitions:
Straight lines, after (re)projection, are usually no longer straight. So, when are they straight?
This example is contrived, but relevant for every line except sections of meridians or the equator.
We can add nodes (st_segmentise
), or remove them (st_simplify
).
For data with ellipsoidal (long/lat) coordinates, sf
1.0-0 switched to using spherical geometry (\(S^2\)) rather than Cartesian geometry (\(R^2\)). Straight lines are now great circle segments on a sphere.
As the Earth’s shape is closer to a sphere than to a flat plane, this is a good thing, but surprises are going to show up for a while due to Cartesian habits for some 50+ years.
To get the “old” (pre-sf
1.0) behaviour, use
sf_use_s2(FALSE)
,st_set_crs(NA)
, or+proj=eqc
.More discussion on this in the (upcoming) Spatial Data Science book by Roger Bivand and me; also do follow Dewey Dunnington.
sf
now uses spherical geometry:
stringsAsFactors
is also no longer TRUE
)rgdal
and rgeos
will retire Jan 1, 2024:
sf
, terra
, stars
, … provide alternatives: