#' This function obtains the geometry type of a vector table in a postgreSQL database.
#' @title Obtains the geometry type of a vector table
#' @name typeGeom
#' @param con An object of class "connectPG" generated by dbConnectPG()
#' @param vecTable Name of vectorial table in the database
#' @return The type of the geometry as a string. For example: "LINESTRING", "POLYGON", etc.
#' @author Bruno Silva
typeGeom <- function(con, vecTable){
if(class(con)!= 'pgConnect') stop('An object of class "pgConnect" is required to connect with the database')
type <-
checkGeom(con, vecTable) %>%
sprintf('SELECT GeometryType(%s) FROM %s', ., vecTable) %>%
RPostgreSQL::dbGetQuery(con[[1]], .)
return(as.character(unique(type)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.