sf_readSQL: Read Spatial SQL Table to sf

Description Usage Arguments Value Creation notes Author(s) Examples

View source: R/DBIhelpers.R

Description

Is basically a wrapper around sf::st_read() that does a necessary transformation on the SQL geometry datatype to read in as a sf table

Usage

1
sf_readSQL(conn, schema, tableName, geomCol)

Arguments

conn

A DBIConnection object, as returned by dbConnect().

schema

Name of schema that table is under. character vector of length 1.

tableName

Name of table. character vector of length 1.

geomCol

Character vector of length 1 containing the name of the geometry column in the SQL table

Value

An sf object

Creation notes

First created in 2020-11-03 with the script OSMdownloadAndSFtoSQLInterface.R in the MARC-KC/HelpLibrary Repository

Author(s)

Jacob Peterson

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
library(DBI)

con <- connectODBC("DB_MARC_PRD.marcdl")

#This is not set up to be a real example
tableColNames <- sf_readSQL(con, "marcdl", "TestTable", "geom")

## End(Not run)

MARC-GIS/marcR documentation built on Nov. 16, 2020, 1:41 p.m.