0

I'm having an issue where a transformation from a projected coordinate system (Lambert azimuthal equal-area) to WGS84 changes the shape of my polygon near the polar region. The real data creates a large sf polygon that extends from near the equator over the southern pole.

If I first project the lat-long points into a custom LAEA (roughly) centered over their spherical centroid before turning them into a polygon via...

polygon <- points %>% st_transform(crs = "+proj=laea +x_0=0 +y_0=0 +lon_0=25.8 +lat_0=-26.0") summarize(geometry = st_combine(geometry)) %>% st_cast('POLYGON')

Lambert azimuthal equal area polygon that covers the southern pole.

But when I leave the points unprojected in WGS84 / lat-long ...

polygon <- points %>% summarize(geometry = st_combine(geometry)) %>% st_cast('POLYGON')

The resulting polygon no longer covers the southern pole, extending only to about 82 degrees south. That corresponds to the southern coast, but not to where points internal to the polygon, e.g. st_sample(), are translated to.

WGS84 polygon that only extends to ~82 degrees south latitude.

The closest post here that I was able to find was this post, but it didn't have much of an answer and didn't use R or sf.

Reproducible Example

sf_re <- matrix(c(65,25,
                      111,-33,
                      82,-77,
                      141, -82,
                      166, -79,
                      -169, -78,
                      -131, -75,
                      -65, -73,
                      -15, -60,
                      -7, -6,
                      35, 14), 
                    ncol = 2, byrow = T) %>% 
      as.data.frame() %>%
      st_as_sf(coords = 1:2, crs = 4326)

centroid <- sf_re %>% st_union() %>% st_centroid() %>% st_coordinates()

crs_laea <- paste0('+proj=laea +x_0=0 +y_0=0 ',
                   '+lon_0=',round(centroid[1],2),
                   ' +lat_0=',round(centroid[2],2))

polygon <- sf_re %>%
  st_transform(crs = crs_laea) %>% 
  summarize(geometry = st_combine(geometry)) %>%
  st_cast('POLYGON')

ggplot() +
  geom_sf(data = st_graticule() %>% st_transform(crs = crs_laea)) + 
  geom_sf(data = polygon, fill = 'dodgerblue')

ggplot() + 
  geom_sf(data = st_graticule()) + 
  geom_sf(data = polygon %>% st_transform(4326), fill = 'dodgerblue')

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy