Generate and display a legend for a map layer using a provided SLD (Styled Layer Descriptor) body.
map_legend_metric.Rd
This function constructs a legend for a map layer by sending a GetLegendGraphic request to a WMS (Web Map Service) server.
Arguments
- sld_body
A character string containing the SLD (Styled Layer Descriptor) body that defines the map layer's styling.
Examples
con <- db_con()
#> Error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
#> Is the server running locally and accepting connections on that socket?
# Define an SLD body for a map layer
sld_body <- sld_get_style(breaks = sld_get_quantile_metric(
selected_region_id = 11,
selected_metric = "active_channel_width",
con = con),
colors = sld_get_quantile_colors(
quantile_breaks = sld_get_quantile_metric(
selected_region_id = 11,
selected_metric = "active_channel_width",
con = con)),
metric = "active_channel_width")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'conn' in selecting a method for function 'sqlInterpolate': object 'con' not found
DBI::dbDisconnect(con)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'conn' in selecting a method for function 'dbDisconnect': object 'con' not found
# Generate and display the legend for the map layer
legend <- map_legend_metric(sld_body)
#> Error in eval(expr, envir, enclos): object 'sld_body' not found