Skip to content

Instantly share code, notes, and snippets.

@ateucher
Created November 2, 2014 07:04
Show Gist options
  • Save ateucher/5bcd5a605065eda2daa0 to your computer and use it in GitHub Desktop.
Save ateucher/5bcd5a605065eda2daa0 to your computer and use it in GitHub Desktop.
## convert back and forth between -180/180 and 0/360 systems
to_lon_360 <- function(lon_180) {
(lon_180 + 360) %% 360
}
to_lon_180 <- function(lon_360) {
((lon_360 + 180) %% 360) - 180
}
to_lon_360(-143.27)
to_lon_360(120.5)
to_lon_180(340)
to_lon_180(123.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment