You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm reading a KMZ file that has solar eclipse paths. I'm using sf::sf_read() on Linux/Ubuntu 18 and the driver is the default LIBKML. Everything works fine until some paths go through the International Date Line (longitude 180). In this case the transformation to an sf object gives unexpected results, as seen in the image below.
Since github does not provide support for .KMZ files I share it in my Drive (only 100Kb):
library(tidyverse)
library(sf)
library(rnaturalearth)
# retrive a list of every layer of the kmz file
l_layers <- sf::st_layers("./test.kmz")$name
# read a given layer of interest
f <- sf::st_read("./test.kmz", layer = l_layers[3])
# download world map as sf
worldmap <- rnaturalearth::ne_countries(returnclass = 'sf')
# plot results
ggplot2::ggplot() +
geom_sf(data = worldmap, mapping = aes(geometry = geometry)) +
geom_sf(data = f, mapping = aes(geometry = geometry))
Does anyone knows what is happening here? Is there other custom drivers that I could use? Is the s2 in the future a solution to this?
Thanks!
The text was updated successfully, but these errors were encountered:
It's (I.M.O.) not the transformation to an sf object, but the assumption made by plotting it on Plate Carree; for this type of plot you need to pull it through st_wrap_dateline first, as in
f= st_wrap_dateline(f)
then we see
Other projections need other manipulations, e.g. to crop to the visible part of the Earth before doing an orthographic projection. see e.g. here.
I'm reading a KMZ file that has solar eclipse paths. I'm using sf::sf_read() on Linux/Ubuntu 18 and the driver is the default LIBKML. Everything works fine until some paths go through the International Date Line (longitude 180). In this case the transformation to an sf object gives unexpected results, as seen in the image below.
Since github does not provide support for .KMZ files I share it in my Drive (only 100Kb):
https://drive.google.com/file/d/1dp21nRucVlaEL2RAhxJsHcpQQpY3QJce/view?usp=sharing
The minimum code I used is:
Does anyone knows what is happening here? Is there other custom drivers that I could use? Is the s2 in the future a solution to this?
Thanks!
The text was updated successfully, but these errors were encountered: