[R-sig-Geo] st_segmentize across east and west hemispheres

Amanda Rehbein @m@nd@@rehbe|n @end|ng |rom u@p@br
Tue Dec 29 00:24:54 CET 2020


Dear r-sig-geo list,

I have a package called raytracing for calculating atmospheric Rossby wave
paths.
I need to get segments of the great circle or routes from some geographical
coordinates. st_segmentize is calculating them correctly. However, when I
need to connect two points in different hemispheres, east and west, it
creates an unwanted horizontal line, as shown in the following example. Is
it possible (and correct) to avoid or remove this horizontal line?


library(sf)
m <- rbind(c(100,-50),
           c(-100,50))
sf <- st_sf(a=1,
           geom=st_sfc(st_linestring(m)),
           crs = 4326)
seg <- st_segmentize(sf, units::set_units(1000, km))
plot(seg, axes = TRUE, reset = FALSE, type = "p", pch = 16)
plot(seg$geom, add = TRUE, col = "red")
text(x = m[, 1], y = m[, 2] - 7, label = 1:2, col = "blue")

Many thanks.

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list