geojson_layer: GeoJSON layer

Description Usage Arguments Examples

View source: R/geojson_layer.R

Description

Add a GeoJSON layer to a d3-carto-map.

Usage

1
2
3
geojson_layer(carto, data, file = NULL, label = "GeoJSON",
  clickable = FALSE, fill = "lightblue", stroke = "black",
  opacity = 0.5, visible = TRUE)

Arguments

carto

The map created by cartographer().

data

A GeoJSON string (unparsed). The GeoJSON can be provided through the file parameter instead.

file

The path to a GeoJSON file.

label

The label for this layer on the layer selector.

clickable

Controls whether a point can be clicked to show the properties in the data frame.

fill

The fill color of the GeoJSON polygons, either as a name recognized by a browser or as a hexadecimal string (e.g., #4527f3).

stroke

The stroke color of the GeoJSON polygons.

opacity

The opacity of the GeoJSON polygons.

visible

Should the layer be initially visible?

Examples

1
2
3
4
# Path to a sample GeoJSON file
land <- system.file("extdata", "land.geojson", package = "cartographer")
cartographer() %>%
  geojson_layer(file = land, label = "Land")

ropensci/cartographer documentation built on May 27, 2019, 2:24 p.m.