We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using this handy recenter function I am able to recenter global spatial SF data to any desired meridian.
However, it doesn't work with your solution for creating a background oceans polygon. When projecting the object to Winkel-Tripel it folds on itself.
Any idea how to do this for 360 degree data?
`### My code shift <- -152 # desired meridian shift
maxlong <- 180 + shift + 360 # shift 180 degrees to 360 degrees minlong <- 180 + shift
longs <- c(rep(c(maxlong, minlong), each = 181), maxlong )
outline <- list(cbind(longs, lats)) %>% st_polygon() %>% st_sfc( # create sf geometry list column crs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" ) %>% st_sf()
outline <- outline %>% st_transform_proj(crs = crs_wintri) # transform to Winkel tripel
ggplot() + geom_sf( data = outline, fill = "#56B4E950", color = "grey30", size = 0.5/.pt ) + coord_sf(datum = NULL) + theme_map()`
The text was updated successfully, but these errors were encountered:
Please provide a complete reproducible example, prepared with the reprex package.
Sorry, something went wrong.
In fact, I later realized that the issue was merely to change the meridian in the projection with:
` shift <- -152 # desired meridian shift central_meridian <- 360 + shift
proj <- sprintf("+proj=wintri +datum=WGS84 +lon_0=%i +no_defs +over", central_meridian) `
Sorry to bother you. Thanks for the link to the reprex vignette, I will read up on that and use it in the future.
No branches or pull requests
Using this handy recenter function I am able to recenter global spatial SF data to any desired meridian.
However, it doesn't work with your solution for creating a background oceans polygon. When projecting the object to Winkel-Tripel it folds on itself.
Any idea how to do this for 360 degree data?
`### My code
shift <- -152 # desired meridian shift
maxlong <- 180 + shift + 360 # shift 180 degrees to 360 degrees
minlong <- 180 + shift
longs <- c(rep(c(maxlong, minlong), each = 181), maxlong )
Your code
outline <-
list(cbind(longs, lats)) %>%
st_polygon() %>%
st_sfc( # create sf geometry list column
crs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
) %>%
st_sf()
outline <- outline %>%
st_transform_proj(crs = crs_wintri) # transform to Winkel tripel
ggplot() +
geom_sf(
data = outline,
fill = "#56B4E950", color = "grey30", size = 0.5/.pt
) +
coord_sf(datum = NULL) +
theme_map()`
The text was updated successfully, but these errors were encountered: