Comments (5)
I am also getting the same results. I am asking around for some pointer and I will get back to you.
from rnaturalearth.
Does this work for you?
Basically, I am creating points regularly spaced over your area. Then, I project these points into your coord system and remove points that are out of view (NAs). Finally, I create a convex hull and use it to crop world
before the projection.
library(tidyverse)
library(rnaturalearth)
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.3, PROJ 9.1.1; sf_use_s2() is TRUE
library(s2)
proj <- "+proj=geos +h=35785831.0 +lat_0=45 +lon_0=-90.476194 +sweep=y"
world <- ne_countries(
continent = c("north america", "south america"),
scale = "medium",
returnclass = "sf"
)
pts <- world |>
# st_bbox() |>
st_sample(size = 2e3, method = "regular") |>
st_transform(proj)
ch <- pts[!st_is_empty(pts), drop = FALSE] |>
s2_convex_hull() |>
st_as_sf() |>
st_transform(st_crs(world))
world2 <- world |>
st_crop(ch)
#> Warning: attribute variables are assumed to be spatially constant throughout
#> all geometries
worldGeos <- st_transform(world2, crs = proj)
ggplot(data = worldGeos) +
geom_sf(color = "lightgray", fill = "lightgray") +
ggtitle("Geostationary Satellite View")
Created on 2024-02-12 with reprex v2.1.0
from rnaturalearth.
That does indeed work for me, thank you!
I think it makes sense to leave the issue open for now, since the underlying bug remains?
from rnaturalearth.
I am not sure if it is a bug of sf
or the underlying implementation. Tagging @edzer just in case this is related to sf
.
from rnaturalearth.
Much simpler solution (credit to @mdsumner)
library(ggplot2)
library(rnaturalearth)
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.0, PROJ 9.2.0; sf_use_s2() is TRUE
world <- ne_countries(
continent = c("north america", "south america"),
scale = "medium",
returnclass = "sf"
)
world <- st_cast(world, "POLYGON")
#> Warning in st_cast.sf(world, "POLYGON"): repeating attributes for all
#> sub-geometries for which they may not be constant
worldGeos <- st_transform(
world,
crs = "+proj=geos +h=35785831.0 +lat_0=45 +lon_0=-90.476194 +sweep=y"
)
ggplot(data = worldGeos) +
geom_sf(color = "lightgray", fill = "lightgray") +
ggtitle("Geostationary Satellite View")
Created on 2024-02-12 with reprex v2.1.0
from rnaturalearth.
Related Issues (20)
- Release rnaturalearth 1.0.0
- Wrong link in About HOT 1
- Pre-compute vignettes so it does no error on CRAN if resource is not available
- Package suggested but not available for checking: ‘rnaturalearthhires’
- Update package version for rnaturalearthdata and rnaturalearthhires to 1.0.0
- Unexpected behavior of medium size country polygon download / while small & large resolution work as advertised HOT 4
- ne_countries message:maptools, rgdal, and rgeos, underpinning this package will retire shortly message HOT 4
- pkgdown
- Deprecate `sp`
- Add support for `vect` of the `terra` package
- Use `pkgdown`
- Function helpers to provide users with available downloadable files
- Change to `sf`/`spatvector` in `rnaturalearthhires` and `rnaturalearthhires`
- sf MULTIPOLYGONs not mergeable across countries HOT 6
- Chatham Islands with New Zealand HOT 4
- `ne_download()` fails to read raster objects HOT 2
- `ne_download()` should not warn about `sp` for raster objects or if `load = FALSE` HOT 1
- `ne_download()` doens't return filename HOT 5
- Invalid geometry world: Loop 0 is not valid HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rnaturalearth.