helpful when using mapshot/saveWidget + webshot to ensure map is zoomed to desired level
### zoom to after rendering (relevant for mapshot)
library(mapview)
map = mapview(franconia)@map| library(osmdata) | |
| library(mapview) | |
| library(sf) | |
| q0 <- opq(bbox = "Bern, Switzerland", timeout = 60) | |
| q1 <- add_osm_feature(q0, key = 'building', value = "hospital") | |
| x <- osmdata_sf(q1) | |
| pols_ctr = st_centroid(x$osm_polygons) | |
| buff = st_buffer(pols_ctr, dist = 0.0015) |
| library(sf) | |
| library(data.table) | |
| library(mapview) | |
| n = 1000 | |
| x = runif(n, 0, 2) | |
| y = runif(n, 0, 1) | |
| pts = st_as_sf(data.frame(id_pt = 1:n, x = x, y = y), coords = c("x", "y")) |
| # devtools::install_github("tim-salabim/leaflet.pixi") | |
| library(mapview) | |
| library(leaflet) | |
| library(leaflet.pixi) | |
| library(sf) | |
| n = 1e6 | |
| df1 = data.frame(x = runif(n, -100, 30), |
| var cols = | |
| [{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.3294},{"r":0.2667,"g":0.0039,"b":0.32 |
| https://jsfiddle.net/7yf6upg5/4/ |
| library(sf) | |
| library(leaflet) | |
| library(leaflet.glify) | |
| library(mapview) | |
| bu = read_sf("/media/timpanse/d8346522-ef28-4d63-9bf3-19fec6e13aab/bu_lenovo/software/testing/mapview/switzerland/buildings.shp") | |
| st = seq(1, nrow(bu), 5e5) | |
| nd = st + 5e5 - 1 | |
| nd[length(nd)] = nrow(bu) |
| viewNodes = function(x, cex = 6) { | |
| crds = sf::st_coordinates(x)[, c("X", "Y")] | |
| n = nrow(crds) | |
| pts = sf::st_as_sf( | |
| data.frame( | |
| id = 1:n, | |
| x = crds[, "X"], | |
| y = crds[, "Y"] | |
| ), | |
| coords = c("x", "y"), |
| ghmd2pdf = function(input, output = NULL, pandoc_opts = NULL) { | |
| # input = "01_analysis/0110_code/01101_r_scripts/030_yield_by_oven.md" | |
| if (is.null(output)) { | |
| output = paste0(tools::file_path_sans_ext(input), ".pdf") | |
| } | |
| lns = readLines(input) | |
| idx = grep("<img src=", lns) |
| library(raster) | |
| library(sf) | |
| library(sp) | |
| library(elevatr) | |
| library(mapview) | |
| library(magick) | |
| library(smoothr) | |
| library(RColorBrewer) | |
| # download from http://www.geodaten.bayern.de/opendata/Verwaltungsgebiete_shp_epsg31468.zip |