geojson_layer: GeoJSON layer

View source: R/geojson_layer.R

geojson_layerR Documentation

GeoJSON layer

Description

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

Usage

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

# 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 18, 2022, 9:49 a.m.