Skip to contents

This function generates a Styled Layer Descriptor (SLD) XML for styling network metric layer based on quantile breaks colors.

Usage

sld_get_style(breaks, colors, metric)

Arguments

breaks

A numeric vector containing quantile breaks.

colors

A character vector of colors generated based on quantile breaks.

metric

The name of the selected metric.

Value

A character string containing the SLD XML for styling data visualization.

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?
# get quantiles from active_channel_width metric
quantile_metrics <- sld_get_quantile_metric(selected_region_id = 11,
                                            selected_metric = "active_channel_width",
                                            con = con)
#> 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

# get color from quantile
quantile_colors <- sld_get_quantile_colors(quantile_breaks = quantile_metrics)
#> Error in eval(expr, envir, enclos): object 'quantile_metrics' not found
# create sld style
sld_style <- sld_get_style(breaks = quantile_metrics,
                           colors = quantile_colors,
                           metric = "active_channel_width")
#> Error in eval(expr, envir, enclos): object 'quantile_metrics' not found
sld_style
#> Error in eval(expr, envir, enclos): object 'sld_style' not found