df_polys <-
meshcode_set(mesh_size = 80) %>%
jpmesh::export_meshes()
df_polys %>%
st_geometry() %>%
plot()
library(ggplot2)
ggplot() +
geom_sf(data = df_polys, fill = NA) +
geom_text(
data = cbind(
mesh = df_polys$meshcode,
df_polys$geometry %>%
st_centroid() %>%
st_coordinates() %>%
as.data.frame()
),
aes(X, Y, label = mesh),
size = 1.2
) +
coord_sf(datum = NA) +
theme_void()
library(leaflet)
leaflet() %>%
addTiles() %>%
addPolygons(data = df_polys)
wip…
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices datasets utils methods base
#>
#> other attached packages:
#> [1] ggplot2_3.3.3 sf_0.9-7 jpmesh_2.0.1.9000
#>
#> loaded via a namespace (and not attached):
#> [1] xfun_0.20 purrr_0.3.4 colorspace_2.0-0 vctrs_0.3.6
#> [5] miniUI_0.1.1.1 htmltools_0.5.1 yaml_2.2.1 rlang_0.4.10
#> [9] e1071_1.7-4 pkgdown_1.6.1 later_1.1.0.1 pillar_1.4.7
#> [13] withr_2.3.0 glue_1.4.2 DBI_1.1.0 lifecycle_0.2.0
#> [17] stringr_1.4.0 munsell_0.5.0 gtable_0.3.0 ragg_0.4.1
#> [21] htmlwidgets_1.5.3 memoise_1.1.0 evaluate_0.14 knitr_1.30
#> [25] fastmap_1.0.1 httpuv_1.5.5 crosstalk_1.1.1 class_7.3-17
#> [29] Rcpp_1.0.5 KernSmooth_2.23-17 xtable_1.8-4 renv_0.12.5
#> [33] promises_1.1.1 scales_1.1.1 classInt_0.4-3 desc_1.2.0
#> [37] leaflet_2.0.4.1 farver_2.0.3 mime_0.9 systemfonts_0.3.2
#> [41] fs_1.5.0 textshaping_0.2.1 digest_0.6.27 stringi_1.5.3
#> [45] shiny_1.5.0 rprojroot_2.0.2 grid_4.0.3 tools_4.0.3
#> [49] magrittr_2.0.1 tibble_3.0.4 crayon_1.3.4 pkgconfig_2.0.3
#> [53] ellipsis_0.3.1 assertthat_0.2.1 rmarkdown_2.6 R6_2.5.0
#> [57] units_0.6-7 compiler_4.0.3