From coordinate to mesh codes.

coords_to_mesh(longitude, latitude, mesh_size = 1, geometry = NULL, ...)

Arguments

longitude

longitude that approximately to .120.0 to 154.0 (double)

latitude

latitude that approximately to 20.0 to 46.0 (double)

mesh_size

Gives the unit in km for target mesh type. That is, 1 for 1km, and 0.5 for 500m. From 80km to 125m. Default is 1.

geometry

XY sfg object

...

other parameters

Value

mesh code (default 3rd meshcode aka 1km mesh)

References

Akio Takenaka: http://takenaka-akio.org/etc/j_map/index.html # nolint

See also

mesh_to_coords() for convert from meshcode to coordinates

Examples

coords_to_mesh(141.3468, 43.06462, mesh_size = 1)
#> [1] "64414277"
coords_to_mesh(139.6917, 35.68949, mesh_size = 0.250)
#> [1] "5339452532"
coords_to_mesh(139.71475, 35.70078)
#> [1] "53394547"
# Using sf (point as sfg object) library(sf)
#> Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
coords_to_mesh(geometry = st_point(c(139.71475, 35.70078)))
#> [1] "53394547"
coords_to_mesh(geometry = st_point(c(130.4412895, 30.2984335)))
#> [1] "45303355"