-1

I have Australia, and Samoa and other Oceania territories in a map. If I plot this with EPSG 4326 proj4string: "+proj=longlat +datum=WGS84 + no_defs" The points fall into the outer edges of the map. This is silly, the islands are close to each other but this projection puts (f.i.) Samoa at -130 and Australia at +120.

How do I move the center (datum?) of the map? For instance still at the equator but through Australia?

Things I've tried:

map_in_sf %>% st_transform("+proj=longlat +lon_wrap=180")

  • lon_0=180
  • +over
Roel Hogervorst
  • 299
  • 3
  • 13

2 Answers2

1

If you just need the country boundaries on a map you can use the world2 dataset from the maps package, which has longitude from 0-360. If you have some specific spatial format such as sf and want to plot with geom_sf in ggplot2, my cursory investigation suggests there might be/have been some issues with respecting wrapping, though it's hard to verify without your data. Look into st_wrap_dateline.

library(tidyverse)
library(maps)
#> 
#> Attaching package: 'maps'
#> The following object is masked from 'package:purrr':
#> 
#>     map
ggplot() +
  theme_bw() +
  borders("world2", region = c("australia", "new zealand", "samoa"))

Created on 2018-03-12 by the reprex package (v0.2.0).

Calum You
  • 14,687
  • 4
  • 23
  • 42
0

Interestingly it seems to be thing related to this projection. (or rather it is not a projection at all. If I use a different projection it does work.

st_transform("+proj=mill +lon_0=-250") It might be related to WGS84 ?

Roel Hogervorst
  • 299
  • 3
  • 13