Skip to contents

Perform a spatial inner join or left join operation on two layers based on largest intersection between spatial features. Spatial joins are performed using sf's st_join.

Usage

spatial_join_tables(f_left, f_right, j_type)

Arguments

f_left

left table in spatial joins - a spatial (sf) data frame.

f_right

Right table in spatial joins - a spatial (sf) data frame.

j_type

A character specifying the type of join to perform. Options for spatial joins include inner and left joins.

Value

j_df A layer of class - a spatial (sf) data frame (i.e. spatial features and attribute columns) returned by the spatial join.

Details

Geometries of both spatial tables are checked for validity (using sf's st_is_valid) and that they are not empty (using sf's st_is_empty). Invalid geometries are dropped before performing spatial joins.