Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
^.*\.Rproj$
^\.git$
^\.Rproj\.user$
^docs$
^vignettes$
Expand All @@ -20,4 +21,8 @@ CLAUDE.md
.DS_Store
^tools/check-save-map-integration\.R$
^tmp$
^slider-demo\.R$
^flowmap-demo\.R$
^tooltip-demo\.R$
^flowmap-screenshot\.png$
^\.dockerignore$
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Package: mapgl
Title: Interactive Maps with 'Mapbox GL JS' and 'MapLibre GL JS'
Version: 0.4.9.9000
Date: 2026-06-12
Authors@R:
person(given = "Kyle", family = "Walker", email = "kyle@walker-data.com", role = c("aut", "cre"))
Date: 2026-06-16
Authors@R: c(
person(given = "Kyle", family = "Walker", email = "kyle@walker-data.com", role = c("aut", "cre")),
person(given = "Egor", family = "Kotov", email = "kotov.egor@gmail.com", role = "ctb",
comment = "flowmap support and histogram time control, adapted from #205"))
Description: Provides an interface to the 'Mapbox GL JS' (<https://docs.mapbox.com/mapbox-gl-js/guides>)
and the 'MapLibre GL JS' (<https://maplibre.org/maplibre-gl-js/docs/>) interactive mapping libraries to help users
create custom interactive maps in R. Users can create interactive globe visualizations; layer 'sf' objects to create
Expand All @@ -13,6 +15,7 @@ URL: https://walker-data.com/mapgl/
BugReports: https://github.com/walkerke/mapgl/issues
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Depends:
Expand Down
86 changes: 86 additions & 0 deletions LICENSE.note
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
This package as a whole is licensed under the MIT License (see LICENSE file).

It bundles several third-party JavaScript components. The FlowmapGL browser bundle shipped at `inst/htmlwidgets/lib/flowmap-gl/flowmap-gl-bundle.min.js` is generated from npm release packages by `data-raw/flowmap-vendor/build-flowmap.sh build`.

Below are the licenses of the individual bundled components:

| Package | Version | License | Source |
| --- | --- | --- | --- |
| @deck.gl/core | 9.3.2 | MIT | https://github.com/visgl/deck.gl.git |
| @deck.gl/layers | 9.3.2 | MIT | https://github.com/visgl/deck.gl.git |
| @deck.gl/mapbox | 9.3.2 | MIT | https://github.com/visgl/deck.gl.git |
| @esbuild/darwin-arm64 | 0.28.0 | MIT | git+https://github.com/evanw/esbuild.git |
| @flowmap.gl/data | 9.3.0 | Apache-2.0 | git@github.com:visgl/flowmap.gl.git |
| @flowmap.gl/layers | 9.3.0 | Apache-2.0 | git@github.com:visgl/flowmap.gl.git |
| @loaders.gl/core | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @loaders.gl/images | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @loaders.gl/loader-utils | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @loaders.gl/schema | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @loaders.gl/schema-utils | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @loaders.gl/worker-utils | 4.4.2 | MIT | https://github.com/visgl/loaders.gl |
| @luma.gl/core | 9.3.3 | MIT | https://github.com/visgl/luma.gl |
| @luma.gl/engine | 9.3.3 | MIT | https://github.com/visgl/luma.gl |
| @luma.gl/shadertools | 9.3.3 | MIT | https://github.com/visgl/luma.gl |
| @luma.gl/webgl | 9.3.3 | MIT | https://github.com/visgl/luma.gl |
| @mapbox/tiny-sdf | 2.2.0 | BSD-2-Clause | git+https://github.com/mapbox/tiny-sdf.git |
| @math.gl/core | 4.1.0 | MIT | https://github.com/visgl/math.gl.git |
| @math.gl/polygon | 4.1.0 | MIT | https://github.com/visgl/math.gl.git |
| @math.gl/sun | 4.1.0 | MIT | https://github.com/visgl/math.gl.git |
| @math.gl/types | 4.1.0 | MIT | https://github.com/visgl/math.gl.git |
| @math.gl/web-mercator | 4.1.0 | MIT | https://github.com/visgl/math.gl.git |
| @probe.gl/env | 4.1.1 | MIT | https://github.com/visgl/probe.gl.git |
| @probe.gl/log | 4.1.1 | MIT | https://github.com/visgl/probe.gl.git |
| @probe.gl/stats | 4.1.1 | MIT | https://github.com/visgl/probe.gl.git |
| @swc/helpers | 0.5.23 | Apache-2.0 | git+https://github.com/swc-project/swc.git |
| @types/command-line-args | 5.2.3 | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git |
| @types/command-line-usage | 5.0.4 | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git |
| @types/geojson | 7946.0.16 | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git |
| @types/node | 24.12.4 | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git |
| @types/offscreencanvas | 2019.7.3 | MIT | https://github.com/DefinitelyTyped/DefinitelyTyped.git |
| ansi-styles | 4.3.0 | MIT | chalk/ansi-styles |
| apache-arrow | 21.1.0 | Apache-2.0 | git+https://github.com/apache/arrow-js.git |
| array-back | 6.2.3 | MIT | git+https://github.com/75lb/array-back.git |
| chalk | 4.1.2 | MIT | chalk/chalk |
| chalk-template | 0.4.0 | MIT | chalk/chalk-template |
| color-convert | 2.0.1 | MIT | Qix-/color-convert |
| color-name | 1.1.4 | MIT | git@github.com:colorjs/color-name.git |
| command-line-args | 6.0.2 | MIT | git+https://github.com/75lb/command-line-args.git |
| command-line-usage | 7.0.4 | MIT | https://github.com/75lb/command-line-usage |
| d3 | 7.9.0 | ISC | https://github.com/d3/d3.git |
| d3-array | 3.2.4 | ISC | https://github.com/d3/d3-array.git |
| d3-color | 3.1.0 | ISC | https://github.com/d3/d3-color.git |
| d3-format | 3.1.2 | ISC | https://github.com/d3/d3-format.git |
| d3-geo | 3.1.1 | ISC | https://github.com/d3/d3-geo.git |
| d3-interpolate | 3.0.1 | ISC | https://github.com/d3/d3-interpolate.git |
| d3-scale | 4.0.2 | ISC | https://github.com/d3/d3-scale.git |
| d3-scale-chromatic | 3.1.0 | ISC | https://github.com/d3/d3-scale-chromatic.git |
| d3-time | 3.1.0 | ISC | https://github.com/d3/d3-time.git |
| d3-time-format | 4.1.0 | ISC | https://github.com/d3/d3-time-format.git |
| earcut | 2.2.4 | ISC | git://github.com/mapbox/earcut.git |
| esbuild | 0.28.0 | MIT | git+https://github.com/evanw/esbuild.git |
| find-replace | 5.0.2 | MIT | git+https://github.com/75lb/find-replace.git |
| flatbuffers | 25.9.23 | Apache-2.0 | git+https://github.com/google/flatbuffers.git |
| gl-matrix | 3.4.4 | MIT | https://github.com/toji/gl-matrix.git |
| has-flag | 4.0.0 | MIT | sindresorhus/has-flag |
| internmap | 2.0.3 | ISC | https://github.com/mbostock/internmap.git |
| json-bignum | 0.0.3 | MIT | https://github.com/datalanche/json-bignum.git |
| kdbush | 4.1.0 | ISC | git://github.com/mourner/kdbush.git |
| lil-gui | 0.19.0 | MIT | https://github.com/georgealways/lil-gui |
| lodash.camelcase | 4.3.0 | MIT | lodash/lodash |
| mjolnir.js | 3.0.0 | MIT | https://github.com/visgl/mjolnir.js |
| reselect | 5.2.0 | MIT | https://github.com/reduxjs/reselect.git |
| seedrandom | 3.0.5 | MIT | git://github.com/davidbau/seedrandom.git |
| supports-color | 7.2.0 | MIT | chalk/supports-color |
| table-layout | 4.1.1 | MIT | https://github.com/75lb/table-layout |
| tslib | 2.8.1 | 0BSD | https://github.com/Microsoft/tslib.git |
| typical | 7.3.0 | MIT | git+https://github.com/75lb/typical.git |
| undici-types | 7.16.0 | MIT | git+https://github.com/nodejs/undici.git |
| wordwrapjs | 5.1.1 | MIT | https://github.com/75lb/wordwrapjs |

## Bundled data

The `bixi_locations` and `bixi_flows` datasets are derived from BIXI Montréal
Open Data (https://bixi.com/fr/donnees-ouvertes), © BIXI Montréal and released
under the BIXI Montréal Open Data license. The data were prepared for the
FlowmapBlue project (https://github.com/FlowmapBlue/FlowmapBlue) by Ilya
Boyandin (https://github.com/ilyabo).
10 changes: 10 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export(add_draw_control)
export(add_features_to_draw)
export(add_fill_extrusion_layer)
export(add_fill_layer)
export(add_flowmap)
export(add_fullscreen_control)
export(add_geocoder_control)
export(add_geolocate_control)
Expand All @@ -37,11 +38,13 @@ export(add_raster_source)
export(add_reset_control)
export(add_scale_control)
export(add_screenshot_control)
export(add_slider_control)
export(add_source)
export(add_symbol_layer)
export(add_vector_source)
export(add_video_source)
export(add_view)
export(as_time_property)
export(basemap_style)
export(bivariate_palettes)
export(bivariate_scale)
Expand All @@ -60,6 +63,7 @@ export(enable_shiny_hover)
export(esri_open_style)
export(esri_style)
export(fit_bounds)
export(flowmap_color_schemes)
export(fly_to)
export(get_breaks)
export(get_column)
Expand Down Expand Up @@ -91,6 +95,7 @@ export(number_format)
export(on_section)
export(openfreemap_style)
export(palette_to_lut)
export(popup_style)
export(print_map)
export(query_rendered_features)
export(renderMapboxgl)
Expand All @@ -100,6 +105,8 @@ export(renderMaplibreCompare)
export(save_map)
export(set_config_property)
export(set_filter)
export(set_flowmap_filter)
export(set_flowmap_settings)
export(set_fog)
export(set_layout_property)
export(set_paint_property)
Expand All @@ -112,6 +119,7 @@ export(set_style)
export(set_terrain)
export(set_tooltip)
export(set_view)
export(slider_style)
export(step_equal_interval)
export(step_expr)
export(step_jenks)
Expand All @@ -120,6 +128,7 @@ export(story_leaflet)
export(story_map)
export(story_maplibre)
export(story_section)
export(tooltip_style)
export(turf_area)
export(turf_buffer)
export(turf_center_of_mass)
Expand All @@ -132,6 +141,7 @@ export(turf_filter)
export(turf_intersect)
export(turf_union)
export(turf_voronoi)
export(update_slider_control)
import(base64enc)
import(geojsonsf)
import(grDevices)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# mapgl 0.5.0

* Tooltips and popups now accept `{brace}` templates package-wide. Any layer's `tooltip`/`popup` (and `set_tooltip()`/`set_popup()`) can take a glue-style template such as `"{name}: {population}"`, in addition to the existing column name and `concat()`/`number_format()` expression forms; substituted values are HTML-escaped.

* New `tooltip_style()` / `popup_style()` helpers theme tooltips and popups without hand-written HTML/CSS, mirroring `legend_style()`. Pass a preset (`"light"`/`"dark"`) or custom appearance (background, border, radius, font, padding, shadow) to the new `tooltip_style`/`popup_style` argument on layer functions (and `set_tooltip()`/`set_popup()`). Tooltips are unstyled by default, so existing maps are unchanged.

* New `add_flowmap()` draws animated origin-destination flow maps powered by Flowmap.gl (deck.gl). It supports temporal flows, location clustering, customizable color schemes (`flowmap_color_schemes()`), CSS blend modes, and themeable tooltips and popups (per-object-type content via `list(location = , flow = )`, styled with `tooltip_style()`/`popup_style()`). Flow filters and settings can be updated reactively in Shiny with `set_flowmap_filter()` and `set_flowmap_settings()`, and a `"window"`-mode `add_slider_control()` can drive a flowmap's temporal range. The heavy flow-mapping libraries load on demand, so maps without a flowmap are unaffected. Adapted from Egor Kotov's contribution in #205, with the bundled `bixi_locations` and `bixi_flows` datasets as a ready-to-use example.

* New `add_slider_control()` adds an interactive slider that filters and/or animates one or more layers by a numeric feature property. It composes with a layer's initial `filter`, later `set_filter()` calls, and interactive legends (intersecting via `["all", ...]`) rather than replacing them. Modes are `"sequential"` (one value), `"cumulative"` (everything through a value), and `"window"` (a selected range that can also drive flowmap time ranges; `window_behavior` chooses a `"resizable"` two-edge range or a `"fixed"`-width band you pan). Two presentations: the default `"compact"` slider, or `presentation = "timeline"` — a prominent, brushable histogram (drag the selected window across the bars, drag its edges to resize) modeled on Egor Kotov's FlowMapBlue time control (#205). Supports paint-property animation, an optional play button, and an optional density histogram (`histogram`/`histogram_data`/`counts`, drawn with d3 loaded on demand). New `slider_style()` presets and overrides control the container, play button, track, thumb, and histogram appearance, and `draggable = TRUE` lets the user reposition the panel anywhere on the map (as with `add_legend()`). Companions `update_slider_control()` (for Shiny proxies) and `as_time_property()` (coerce `Date`/`POSIXct` to a numeric filter property) round out the feature.

* Update MapLibre GL JS to v5.24.0 and Mapbox GL JS to v3.24.0.

* Fixed `add_legend()` silently ignoring the `target` argument for MapLibre compare widgets: the compare dispatch checked for class `"maplibre_compare"` while the widget class is `"maplibregl_compare"`, so legends were attached as regular map legends instead of compare-level legends.
Expand Down
53 changes: 53 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#' BIXI Montréal Bike Share Stations (2019)
#'
#' A dataset containing the names and coordinates of BIXI bicycle sharing
#' stations in Montréal, Quebec, Canada.
#'
#' @format A data frame with 618 rows and 4 variables:
#' \describe{
#' \item{id}{Unique station ID (character, e.g., `"4000"`, `"MTL-ECO5.1-01"`)}
#' \item{name}{Station name (character, e.g., `"Jeanne-d'Arc / Ontario"`)}
#' \item{lat}{Latitude coordinate (numeric)}
#' \item{lon}{Longitude coordinate (numeric)}
#' }
#' @source BIXI Montréal Open Data (\url{https://bixi.com/fr/donnees-ouvertes}).
#' Prepared for \url{https://github.com/FlowmapBlue/FlowmapBlue} by Ilya Boyandin (\url{https://github.com/ilyabo}).
#' Data \enc{©}{(c)} BIXI Montréal, released under the BIXI Montréal Open Data
#' license (\url{https://bixi.com/fr/donnees-ouvertes}).
#' @seealso \code{\link{bixi_flows}}
#' @examples
#' # Convert to sf object to view on a map
#' if (requireNamespace("sf", quietly = TRUE)) {
#' bixi_sf <- sf::st_as_sf(bixi_locations, coords = c("lon", "lat"), crs = 4326)
#' print(head(bixi_sf))
#' }
"bixi_locations"

#' BIXI Montréal Hourly Bike Sharing Flows (July 1-7, 2019)
#'
#' A dataset containing hourly aggregated bike sharing trips between BIXI
#' stations in Montréal during the week of July 1 to July 7, 2019.
#'
#' To minimize the package footprint, the dataset has been truncated to a
#' **minimum of three trips** (retaining only flows where \code{count > 2}),
#' which reduces the rows from 213,227 to 6,092, and compresses the final size
#' to just **~22 KB**.
#'
#' @format A data frame with 6,092 rows and 4 variables:
#' \describe{
#' \item{time}{Hourly timestamp (POSIXct, UTC)}
#' \item{origin}{Origin station ID (factor, matching \code{bixi_locations$id})}
#' \item{dest}{Destination station ID (factor, matching \code{bixi_locations$id})}
#' \item{count}{Aggregated number of bike sharing trips in that hour (integer)}
#' }
#' @source BIXI Montréal Open Data (\url{https://bixi.com/fr/donnees-ouvertes}).
#' Prepared for \url{https://github.com/FlowmapBlue/FlowmapBlue} by Ilya Boyandin (\url{https://github.com/ilyabo}).
#' Data \enc{©}{(c)} BIXI Montréal, released under the BIXI Montréal Open Data
#' license (\url{https://bixi.com/fr/donnees-ouvertes}).
#' Original interactive visualization on Flowmap.blue:
#' \url{https://www.flowmap.blue/1qTVOzkPB7U1ySI4g4uPtVBzzEDCI8n1WXAmQeZL15fE}
#' @seealso \code{\link{bixi_locations}}
#' @examples
#' # Check first few records
#' print(head(bixi_flows))
"bixi_flows"
Loading
Loading