| Title: | Formats Spatial Data for Use in Htmlwidgets |
|---|---|
| Description: | Many packages use 'htmlwidgets' <https://CRAN.R-project.org/package=htmlwidgets> for interactive plotting of spatial data. This package provides functions for converting R objects, such as simple features, into structures suitable for use in 'htmlwidgets' mapping libraries. |
| Authors: | David Cooley [aut, cre] |
| Maintainer: | David Cooley <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.6 |
| Built: | 2026-06-06 10:07:05 UTC |
| Source: | https://github.com/symbolixau/spatialwidget |
A simple feature sf object with two sfc columns, "origin" and "destination"
widget_arcswidget_arcs
A sf object with 199 observations and 6 variables
origin country
origin capital
destination country
destination capital
sfc geometry column
sfc geometry column
A simple feature sf object containing the coordinates of 200 capitical cities in the world
widget_capitalswidget_capitals
A sf object with 200 observations and 4 variables
country name
capital name
sfc geometry column
Converts an 'sf' object with LINESTRING geometriers into JSON for plotting in an htmlwidget
widget_line( data, stroke_colour = NULL, stroke_opacity = NULL, stroke_width = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )widget_line( data, stroke_colour = NULL, stroke_opacity = NULL, stroke_width = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )
data |
|
stroke_colour |
string specifying column of |
stroke_opacity |
string specifying column of |
stroke_width |
string specifying column of |
legend |
logical indicating if legend data will be returned |
json_legend |
logical indicating if the legend will be returned as json |
digits |
number of decimal places for rounding lon o& lat coordinates. Default 6 |
## use default stroke options l <- widget_line( widget_roads, legend = TRUE )## use default stroke options l <- widget_line( widget_roads, legend = TRUE )
A simple feature sf object of Polygons for Melbourne and the surrounding area
widget_melbournewidget_melbourne
A data frame with 397 observations and 7 variables
statistical area 2 name of the polygon
statistical area 3 name of the polygon
area of the SA2 polygon
sfc geometry column
This data set is a subset of the Statistical Area Level 2 (SA2) ASGS Edition 2016 data released by the Australian Bureau of Statistics https://www.abs.gov.au/
The data is realeased under a Creative Commons Attribution 2.5 Australia licence https://creativecommons.org/licenses/by/2.5/au/
The data has been down-cast from MULTIPOLYGONS to POLYGONS.
Converts an 'sf' object with two POINT geometriers into JSON for plotting in an htmlwidget
widget_od( data, origin, destination, fill_colour = NULL, fill_opacity = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )widget_od( data, origin, destination, fill_colour = NULL, fill_opacity = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )
data |
|
origin |
string specifying the column of |
destination |
string specifying the column of |
fill_colour |
string specifying column of |
fill_opacity |
string specifying column of |
legend |
logical indicating if legend data will be returned |
json_legend |
logical indicating if the legend will be returned as json |
digits |
number of decimal places for rounding lon o& lat coordinates. Default 6 |
l <- widget_od( data = widget_arcs, origin = "origin", destination = "destination", legend = FALSE )l <- widget_od( data = widget_arcs, origin = "origin", destination = "destination", legend = FALSE )
Converts an 'sf' object with POINT geometriers into JSON for plotting in an htmlwidget
widget_point( data, fill_colour = NULL, fill_opacity = NULL, lon = NULL, lat = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )widget_point( data, fill_colour = NULL, fill_opacity = NULL, lon = NULL, lat = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )
data |
|
fill_colour |
string specifying column of |
fill_opacity |
string specifying column of |
lon |
string specifying the column of |
lat |
string specifying the column of |
legend |
logical indicating if legend data will be returned |
json_legend |
logical indicating if the legend will be returned as json |
digits |
number of decimal places for rounding lon o& lat coordinates. Default 6 |
l <- widget_point( data = widget_capitals, legend = FALSE )l <- widget_point( data = widget_capitals, legend = FALSE )
Converts an 'sf' object with POLYGON geometriers into JSON for plotting in an htmlwidget
widget_polygon( data, stroke_colour = NULL, stroke_opacity = NULL, stroke_width = NULL, fill_colour = NULL, fill_opacity = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )widget_polygon( data, stroke_colour = NULL, stroke_opacity = NULL, stroke_width = NULL, fill_colour = NULL, fill_opacity = NULL, legend = TRUE, json_legend = TRUE, digits = 6 )
data |
|
stroke_colour |
string specifying column of |
stroke_opacity |
string specifying column of |
stroke_width |
string specifying column of |
fill_colour |
string specifying column of |
fill_opacity |
string specifying column of |
legend |
logical indicating if legend data will be returned |
json_legend |
logical indicating if the legend will be returned as json |
digits |
number of decimal places for rounding lon o& lat coordinates. Default 6 |
l <- widget_polygon( widget_melbourne, legend = FALSE ) l <- widget_polygon( widget_melbourne, fill_colour = "AREASQKM16", legend = TRUE )l <- widget_polygon( widget_melbourne, legend = FALSE ) l <- widget_polygon( widget_melbourne, fill_colour = "AREASQKM16", legend = TRUE )
A simple feature sf object of roads in central Melbourne
widget_roadswidget_roads
An sf and data frame object with 18286 observations and 16 variables
Obtained from https://www.data.gov.au/ and distributed under the Creative Commons 4 License https://creativecommons.org/licenses/by/4.0/