Skip to contents

spa_is_empty() checks whether a given pgeometry object is empty (i.e., if it does not contain components).

Usage

spa_is_empty(pgo)

Arguments

pgo

A pgeometry object.

Value

A Boolean value that indicates if a pgeometry is empty.

Details

The spa_is_empty() function checks if a pgeometry object has any component or not. If the number of components of a pgeometry object is equal to 0, then it returns TRUE. Otherwise, it returns FALSE.

Examples

# Creating an empty plateau line object 
pgo1 <- create_empty_pgeometry("PLATEAULINE")

# Checking if it is empty
spa_is_empty(pgo1)
#> [1] TRUE

# Adding a component to it and checking if it still empty
comp <- create_component("LINESTRING(1 1, 2 2, 2 3)", 0.5)
pgo1 <- spa_add_component(pgo1, comp)
spa_is_empty(pgo1)  
#> [1] FALSE