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| # This will watch your global environment for sf objects and mapview them automagically. | |
| library(later) | |
| library(mapview) | |
| last_value = NULL | |
| dir <- tempfile() | |
| dir.create(dir) | |
| htmlFile <- file.path(dir, "index.html") |
| library(ggplot2) | |
| library(leafgl) | |
| library(leaflet) | |
| library(sf) | |
| sfx <- sf::st_transform(sf::st_cast(dplyr::filter(silicate::inlandwaters, Province == "Tasmania"), "POLYGON")[2, ], 4326) | |
| topo <- ceramic::cc_elevation(sfx, zoom = 9) | |
| mesh <- anglr::as.mesh3d(anglr::copy_down(anglr::DEL(sfx, max_area = .0001), |
| library(V8) | |
| library(mapview) | |
| library(geojsonsf) | |
| ct = v8(global="window") | |
| ct$source("https://cdn.jsdelivr.net/npm/[email protected]/dist/flatgeobuf-geojson.min.js") | |
| ct$get("Object.keys(window)") | |
| fran = sf_geojson(franconia[1, ]) |
| 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 |
| 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) |
| 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"), |
| 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) |
| https://jsfiddle.net/7yf6upg5/4/ |
| 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 |