
Transform Data to the jpmap Projection
jpmap_transform.RdTransforms geographic data to the jpmap projected coordinate system. When
inset = TRUE, Okinawa and Ogasawara are moved to visible inset
locations. Use okinawa = FALSE, ogasawara = FALSE,
inset = "okinawa", or inset = "ogasawara" to transport only one
island group.
Usage
jpmap_transform(
data,
input_names = c("lon", "lat"),
output_names = input_names,
inset = TRUE,
okinawa = TRUE,
ogasawara = TRUE
)Arguments
- data
An
sfobject,sfcgeometry vector, or data frame.- input_names
Longitude and latitude column names for data frames.
- output_names
Output coordinate column names for data frames.
- inset
Inset behavior. Use
TRUEto move both Okinawa and Ogasawara,FALSEfor no movement, or a character vector containing"okinawa"and/or"ogasawara"to move selected island groups.- okinawa
Whether Okinawa should be moved when
insetincludes it.- ogasawara
Whether Ogasawara should be moved when
insetincludes it.
Examples
if (requireNamespace("tibble", quietly = TRUE)) {
places <- tibble::tribble(
~place, ~lon, ~lat,
"Tokyo", 139.767, 35.681,
"Naha", 127.681, 26.212,
"Ogasawara", 142.191, 27.094
)
places |>
jpmap_transform(output_names = c("x", "y"))
places |>
jpmap_transform(output_names = c("x", "y"), inset = "okinawa")
places |>
jpmap_transform(output_names = c("x", "y"), ogasawara = FALSE)
}
#> # A tibble: 3 × 5
#> place lon lat x y
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 Tokyo 140. 35.7 205212. -199414.
#> 2 Naha 128. 26.2 -683245. 657517.
#> 3 Ogasawara 142. 27.1 466807. -1141584.