evaluate_node_query: Query specific node indices from a spatial network

View source: R/ids.R

evaluate_node_queryR Documentation

Query specific node indices from a spatial network

Description

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

Usage

evaluate_node_query(data, query)

Arguments

data

An object of class sfnetwork.

query

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

Details

There are multiple ways in which node 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 node to each feature is found by calling st_nearest_feature.

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

  • As node predicate query function: A node predicate query function defines for each node if a given spatial predicate applies to the spatial relation between that node 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 node 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 node indices. A node index corresponds to a row-number in the nodes table of the network.

  • As characters: Characters are interpreted as node names. A node name corresponds to a value in a column named "name" in the the nodes 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 node 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.

Value

A vector of queried node indices.


luukvdmeer/sfnetworks documentation built on Nov. 21, 2024, 4:54 a.m.