Skip to contents

This function is not meant to be called directly, but used inside other functions that accept an edge query.

Usage

evaluate_edge_query(data, query)

Arguments

data

An object of class sfnetwork.

query

The query that defines for which edges to extract indices, defused into a quosure. See Details for the different ways in which edge queries can be formulated.

Value

A vector of queried edge indices.

Details

There are multiple ways in which edge indices can be queried in sfnetworks. The query can be formatted as follows:

  • As spatial features: Spatial features can be given as object of class sf or sfc. The nearest edge to each feature is found by calling st_nearest_feature.

  • As edge type query function: A edge type query function defines for each edge if it is of a given type or not. Nodes that meet the criterium are queried.

  • As edge predicate query function: A edge predicate query function defines for each edge if a given spatial predicate applies to the spatial relation between that edge and other spatial features. Nodes that meet the criterium are queried.

  • As column name: The referenced column is expected to have logical values defining for each edge if it should be queried or not. Note that tidy evaluation is used and hence the column name should be unquoted.

  • As integers: Integers are interpreted as edge indices. A edge index corresponds to a row-number in the edges table of the network.

  • As characters: Characters are interpreted as edge names. A edge name corresponds to a value in a column named "name" in the the edges table of the network. Note that this column is expected to store unique names without any duplicated values.

  • As logicals: Logicals should define for each edge if it should be queried or not.

Queries that can not be evaluated in any of the ways described above will be forcefully converted to integers using as.integer.