view_mvt: View a local vector tileset on a map

View source: R/viewer.R

view_mvtR Documentation

View a local vector tileset on a map

Description

Given a local .mtiles file containing a vector tiles database, this function will start a local development server to serve the tiles and then return a htmlwidget map that displays the tileset.

Usage

view_mvt(
  tiles_path,
  get_fill_color = "#FFFFFF70",
  get_line_color = "#ffffffff",
  get_line_width = 2,
  line_width_units = "pixels",
  get_point_radius = 2,
  point_radius_units = "pixels",
  stroked = TRUE,
  tooltip = TRUE,
  pickable = TRUE,
  ...,
  .serve_mode = "in-memory"
)

Arguments

tiles_path

The path to an .mbtiles file.

get_fill_color

the fill colour of plotted features.

get_line_color

the line colour of plotted features.

get_line_width

the line width of plotted features (in pixels by default).

line_width_units

the units of the value supplied in get_line_width. "meters" may be preferred in some cases.

get_point_radius

the radius of plotted point features (in pixels by default).

point_radius_units

the units of the value supplied in get_point_radius. "meters" may be preferred in some cases.

stroked

use a line on the borders of polygons or points? TRUE by default.

tooltip

generate a tooltip for feature attributes? TRUE by default.

pickable

allow map to react to features that get mouse hover? Needs to be enabled to view tooltips. TRUE by default.

...

further arguments forwarded to rdeck::add_mvt_layer().

.serve_mode

The way in which the server handles the vector tiles database. "in-memory" is the default and it will read the entire tile database into R as a tibble. "disk" will read tiles from the .mbtiles file as an SQLite database from disk. The default is more performant. Use "disk" only if you have a large vector tileset that would consume too much memory to hold in RAM at once.

Details

The map is powered by the awesome rdeck package, which is highly recommended for making interactive WebGL maps in R.

The graphics options of this function are passed directed to ' rdeck::add_mvt_layer(), and so suppourt rdeck color scales based on attributes. See the rdeck helpfile for more detailed ' descriptions.

The graphics parameters apply only to relvant geometries. For ' example: 'fill color' is not used for line string features.


MilesMcBain/mvtview documentation built on April 9, 2022, 5:15 p.m.