Type: | Package |
Title: | Formats Spatial Data for Use in Htmlwidgets |
Version: | 0.2.5 |
Date: | 2024-01-22 |
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. |
URL: | https://symbolixau.github.io/spatialwidget/articles/spatialwidget.html |
License: | MIT + file LICENSE |
Depends: | R (≥ 3.3.0) |
Encoding: | UTF-8 |
LazyData: | true |
SystemRequirements: | C++14 |
Imports: | Rcpp |
LinkingTo: | BH (≥ 1.84.0), colourvalues (≥ 0.3.9), geojsonsf (≥ 2.0.3), geometries (≥ 0.2.4), interleave (≥ 0.1.2), jsonify (≥ 1.2.2), rapidjsonr, Rcpp (≥ 0.12.18), sfheaders (≥ 0.4.4) |
RoxygenNote: | 7.2.3 |
Suggests: | colourvalues, covr, geojsonsf, jsonify, sfheaders, knitr, rmarkdown, testthat |
VignetteBuilder: | knitr |
NeedsCompilation: | yes |
Packaged: | 2024-01-22 04:42:33 UTC; david |
Author: | David Cooley [aut, cre] |
Maintainer: | David Cooley <dcooley@symbolix.com.au> |
Repository: | CRAN |
Date/Publication: | 2024-01-22 14:10:02 UTC |
Origin Destination points between Sydney, Australia and other capitals cities
Description
A simple feature sf
object with two sfc
columns, "origin" and "destination"
Usage
widget_arcs
Format
A sf object with 199 observations and 6 variables
- country_from
origin country
- capital_from
origin capital
- country_to
destination country
- capital_to
destination capital
- origin
sfc geometry column
- destination
sfc geometry column
Capital cities for each country
Description
A simple feature sf
object containing the coordinates of 200 capitical cities in the world
Usage
widget_capitals
Format
A sf object with 200 observations and 4 variables
- country
country name
- capital
capital name
- geometry
sfc geometry column
Widget Line
Description
Converts an 'sf' object with LINESTRING geometriers into JSON for plotting in an htmlwidget
Usage
widget_line(
data,
stroke_colour = NULL,
stroke_opacity = NULL,
stroke_width = NULL,
legend = TRUE,
json_legend = TRUE,
digits = 6
)
Arguments
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 |
Examples
## use default stroke options
l <- widget_line( widget_roads, legend = TRUE )
Melbourne
Description
A simple feature sf
object of Polygons for Melbourne and the surrounding area
Usage
widget_melbourne
Format
A data frame with 397 observations and 7 variables
- SA2_NAME
statistical area 2 name of the polygon
- SA3_NAME
statistical area 3 name of the polygon
- AREASQKM
area of the SA2 polygon
- geometry
sfc geometry column
Details
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.
Widget OD
Description
Converts an 'sf' object with two POINT geometriers into JSON for plotting in an htmlwidget
Usage
widget_od(
data,
origin,
destination,
fill_colour = NULL,
fill_opacity = NULL,
legend = TRUE,
json_legend = TRUE,
digits = 6
)
Arguments
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 |
Examples
l <- widget_od( data = widget_arcs, origin = "origin", destination = "destination", legend = FALSE )
Widget Point
Description
Converts an 'sf' object with POINT geometriers into JSON for plotting in an htmlwidget
Usage
widget_point(
data,
fill_colour = NULL,
fill_opacity = NULL,
lon = NULL,
lat = NULL,
legend = TRUE,
json_legend = TRUE,
digits = 6
)
Arguments
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 |
Examples
l <- widget_point( data = widget_capitals, legend = FALSE )
Widget Polygon
Description
Converts an 'sf' object with POLYGON geometriers into JSON for plotting in an htmlwidget
Usage
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
)
Arguments
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 |
Examples
l <- widget_polygon( widget_melbourne, legend = FALSE )
l <- widget_polygon( widget_melbourne, fill_colour = "AREASQKM16", legend = TRUE )
Roads in central Melbourne
Description
A simple feature sf
object of roads in central Melbourne
Usage
widget_roads
Format
An sf and data frame object with 18286 observations and 16 variables
Details
Obtained from https://www.data.gov.au/ and distributed under the Creative Commons 4 License https://creativecommons.org/licenses/by/4.0/