Convert and export meshcode area to sf.

export_meshes(meshcode)

meshcode_sf(data, mesh_var)

Arguments

meshcode

character. mesh code

data

data.frame

mesh_var

unquoted expressions for meshcode variable.

Examples

export_meshes("4128")
#> Simple feature collection with 1 feature and 1 field #> Geometry type: POLYGON #> Dimension: XY #> Bounding box: xmin: 128 ymin: 27.33333 xmax: 129 ymax: 28 #> Geodetic CRS: WGS 84 #> # A tibble: 1 x 2 #> meshcode geometry #> <meshcode> <POLYGON [°]> #> 1 4128 ((128 27.33333, 129 27.33333, 129 28, 128 28, 128 27.33333))
find_neighbor_mesh("37250395") %>% export_meshes()
#> Simple feature collection with 9 features and 1 field #> Geometry type: POLYGON #> Dimension: XY #> Bounding box: xmin: 125.425 ymin: 24.73333 xmax: 125.4625 ymax: 24.75833 #> Geodetic CRS: WGS 84 #> # A tibble: 9 x 2 #> meshcode geometry #> <meshcode> <POLYGON [°]> #> 1 37250384 ((125.425 24.73333, 125.4375 24.73333, 125.4375 24.74167, 125.425 … #> 2 37250385 ((125.4375 24.73333, 125.45 24.73333, 125.45 24.74167, 125.4375 24… #> 3 37250386 ((125.45 24.73333, 125.4625 24.73333, 125.4625 24.74167, 125.45 24… #> 4 37250394 ((125.425 24.74167, 125.4375 24.74167, 125.4375 24.75, 125.425 24.… #> 5 37250395 ((125.4375 24.74167, 125.45 24.74167, 125.45 24.75, 125.4375 24.75… #> 6 37250396 ((125.45 24.74167, 125.4625 24.74167, 125.4625 24.75, 125.45 24.75… #> 7 37251304 ((125.425 24.75, 125.4375 24.75, 125.4375 24.75833, 125.425 24.758… #> 8 37251305 ((125.4375 24.75, 125.45 24.75, 125.45 24.75833, 125.4375 24.75833… #> 9 37251306 ((125.45 24.75, 125.4625 24.75, 125.4625 24.75833, 125.45 24.75833…
d <- data.frame(id = seq.int(4), meshcode = rmesh(4), stringsAsFactors = FALSE) meshcode_sf(d, meshcode)
#> Simple feature collection with 4 features and 2 fields #> Geometry type: POLYGON #> Dimension: XY #> Bounding box: xmin: 129.9875 ymin: 32.41667 xmax: 140.5625 ymax: 42.91667 #> Geodetic CRS: WGS 84 #> # A tibble: 4 x 3 #> id meshcode geometry #> <int> <meshcode> <POLYGON [°]> #> 1 1 60403310 ((140.375 40.25833, 140.3875 40.25833, 140.3875 40.26667, 14… #> 2 2 56371798 ((137.975 37.49167, 137.9875 37.49167, 137.9875 37.5, 137.97… #> 3 3 48295709 ((129.9875 32.41667, 130 32.41667, 130 32.425, 129.9875 32.4… #> 4 4 64402494 ((140.55 42.90833, 140.5625 42.90833, 140.5625 42.91667, 140…