Skip to content

Instantly share code, notes, and snippets.

View tim-salabim's full-sized avatar
💭
not much

tim-salabim

💭
not much
View GitHub Profile
@tim-salabim
tim-salabim / maplibre_deck_nopicking
Last active July 31, 2026 12:42
maplibre map with deckgl overlay - picking not working
<!DOCTYPE html>
<html lang="en">
<head>
<title>Toggle deck.gl layer</title>
<meta property="og:description" content="Toggle deck.gl layer using maplibre." />
<meta property="og:category" content="Plugins & Integrations" />
<meta property="og:created" content="2024-01-19" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@6.1.0/dist/maplibre-gl.css" />
@tim-salabim
tim-salabim / maplibre_deck_picking
Created July 31, 2026 12:32
maplibre map with deckgl overlay - picking working
<!DOCTYPE html>
<html lang="en">
<head>
<title>Toggle deck.gl layer</title>
<meta property="og:description" content="Toggle deck.gl layer using maplibre." />
<meta property="og:category" content="Plugins & Integrations" />
<meta property="og:created" content="2024-01-19" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@6.1.0/dist/maplibre-gl.css" />
addGlobeControl = function(map) {
let globecontrol = new maplibregl.GlobeControl();
map.addControl(globecontrol);
return map;
}
addDeckGlPolygons = function(map, geom_column_name, layerId) {
let gaDeckLayers = window["@geoarrow/deck"]["gl-layers"];
let data_fl = document.getElementById(layerId + '-1-attachment');
fetch(data_fl.href)
.then(result => Arrow.tableFromIPC(result))
.then(arrow_table => {
let geoArrowPolygon = new gaDeckLayers.GeoArrowPolygonLayer({
id: layerId,
@tim-salabim
tim-salabim / add_deckgl_polygons.R
Last active February 5, 2025 19:01
add deckgl polygonLayer to a maplibre map using mapgl. Utilizes the blazing fast data transfer via arrow IPC stream
add_deckgl_polygons = function(
map
, data
, layerId
, geom_column_name = attr(data, "sf_column")
) {
path_layer = tempfile()
dir.create(path_layer)
path_layer = paste0(path_layer, "/", layerId, "_layer.arrow")
@tim-salabim
tim-salabim / layer_selector.R
Created February 25, 2023 13:29
layer selector
library(mapview)
library(leafem)
library(leaflet)
library(sf)
library(geojsonsf)
franc_ext <- unname(as.vector(st_bbox(franconia)))
francgj = geojsonsf::sf_geojson(franconia)
leaflet() |>
@tim-salabim
tim-salabim / snappy.qmd
Created February 15, 2023 16:22
snappy decompression issue
---
title: "snappy decompression issue"
---
```{r}
#| message: false
library(reticulate)
library(ggplot2)
library(arrow)
#!/bin/bash
url="/vsicurl/https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.20220608/conus/hrrr.t00z.wrfsfcf00.grib2"
bnds="-b 62 -b 77 -b 78 -b 79 -b 9 -b 71 -b 74 -b 75 -b 107 -b 112 -b 150 -b 105 -b 106 -b 124 -b 123 -b 126 -b 125"
ext="-2097264.0 -2088264.0 713109.3 722109.3"
dmsn="9 9"
prj="EPSG:9001"
ofl="/home/tim/Downloads/novsi.tif"
#!/bin/bash
url="https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.20220608/conus/hrrr.t00z.wrfsfcf00.grib2"
bnds="-b 62 -b 77 -b 78 -b 79 -b 9 -b 71 -b 74 -b 75 -b 107 -b 112 -b 150 -b 105 -b 106 -b 124 -b 123 -b 126 -b 125"
ext="-2097264.0 -2088264.0 713109.3 722109.3"
dmsn="9 9"
prj="EPSG:9001"
ofl="/home/tim/Downloads/novsi.tif"
@tim-salabim
tim-salabim / css_generator.R
Created May 1, 2021 08:46
Create custom CSS to use in popupTable
library(leaflet)
library(leafpop)
## using a custom css to style the table
className = "my-popup"
css = list(
"background" = "#ff00ff"
)