Straight Lines
- How does the GeoJSON format (Butler et al. 2016) define “straight” lines between ellipsoidal coordinates (Section 3.1.1)? Using this definition of straight, how does LINESTRING(0 85,180 85) look like in an Arctic polar projection? How could this geometry be modified to have it cross the North Pole?
this_linestring <- st_linestring(matrix(c(0, 85, 180, 85), ncol = 2),
dim = "XY")
class(this_linestring)
## [1] "XY" "LINESTRING" "sfg"
this_linestring |>
ggplot() +
geom_sf(color = "red", linewidth = 3) +
labs(title = "This Linestring",
subtitle = "Where is it?",
caption = "Spatial Data Science book club") +
theme_minimal()
# https://stackoverflow.com/questions/58919102/map-arctic-subarctic-regions-in-ggplot2-with-lambert-conformal-conic-projection
world <- ne_countries(scale = "medium", returnclass = "sf")
world_cropped <- world |>
st_make_valid() |>
st_crop(xmin = -180.0, xmax = 180.0, ymin = 45.0, ymax = 90.0)
## Warning: attribute variables are assumed to be spatially constant throughout
## all geometries
# st_sfc(this_linestring) <- st_crs(world_cropped)
# this_linestring_sf <- st_sf(this_linestring,
# st_sfc(this_linestring, crs = "EPSG:3995"))
ggplot(data = world_cropped) +
geom_sf() +
# geom_sf(data = this_linestring, color = 'red') +
coord_sf(crs =
"+proj=lcc +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0")