Draws a data frame or sf object as a client side feature layer. Colour
takes a bare column name, the same as set_color() does on a chart.
Arguments
- map
Defines which map to modify.
- .data
Defines which
sfobject supplies the features.- ...
Passed between methods. Must be empty when
.datais an IFeatureLayer, whose own properties already answercolor,palette,sizeandtooltip.- color
default
NULL. Defines which column drives the symbol colour. A numeric column becomes a gradient, anything else one colour per value.- palette
default
NULL. Defines the colour ramp, either an Esri ramp name fromesri_palettes()or a vector of R colours.- size
default
NULL. Defines the marker size or line width in points.- opacity
default
NULL. Defines the layer opacity, from0to1.- name
default
NULL. Defines the layer name, which is also the handleremove_layer()andset_layer()take. On anarc_map_proxy()it is required, because that is what tells the browser which layer is meant.- tooltip
default
NULL. Defines which columns are shown when a feature is hovered, as bare column names wrapped inc(). Name one to label it, as inc(County = NAME).- selectable
default
NULL. Defines whether clicking a feature adds it to the selection, which arrives in Shiny asinput$<output_id>$selection. Seeset_selection().- visible
default
NULL. Defines whether the layer starts drawn. Only when.datais an IFeatureLayer.
Details
.data is either a data frame to build a layer from, or an
IFeatureLayer you built yourself. The second form is the escape hatch:
anything this function does not expose is done by constructing the layer
and modifying it, usually with add_renderer().
nc |>
as_feature_layer() |>
add_renderer(ISimpleRenderer(symbol = my_symbol)) |>
(\(lyr) add_layer(arc_map(), lyr))()Examples
set_basemap(arc_map(), "gray-vector")