Return geometry type
st_geometrytype.Rd
This function returns the geometry type of the specified geometry column in
a dbSpatial
object.
Usage
st_geometrytype(dbSpatial, geomName = "geom", ...)
# S4 method for class 'dbSpatial'
st_geometrytype(dbSpatial, geomName = "geom", ...)
See also
Other geom_scalar:
st_isvalid()
Examples
# Create a data.frame with x and y coordinates and attributes
coordinates <- data.frame(x = c(100, 200, 300), y = c(500, 600, 700))
attributes <- data.frame(id = 1:3, name = c("A", "B", "C"))
# Combine the coordinates and attributes
dummy_data <- cbind(coordinates, attributes)
# Create a duckdb connection
con = DBI::dbConnect(duckdb::duckdb(), ":memory:")
# Create a duckdb table with spatial points
db_points = dbSpatial(conn = con,
value = dummy_data,
x_colName = "x",
y_colName = "y",
name = "foo",
overwrite = TRUE)
st_geometrytype(dbSpatial = db_points)
#> # Class: dbSpatial
#> # Source: SQL [3 x 1]
#> # Database: DuckDB v1.0.0 [unknown@Linux 6.5.0-1025-azure:R 4.4.1/:memory:]
#> geom
#> <fct>
#> 1 POINT
#> 2 POINT
#> 3 POINT