pgisSimplifyGeom: Simplify geometry of a PostGIS table

Description Usage Arguments Examples

View source: R/geometry.R

Description

Highly detailed geometries use more memory and make geoprocesses longer. If we don't need high precision, we can simplify (=generalize) it.

Usage

1
2
3
4
5
6
7
8
pgisSimplifyGeom(
  conn,
  tbl,
  tolerance,
  geom.col = "geometry",
  new.geom.col = "geometry_simpl",
  verbose = TRUE
)

Arguments

conn

a PostgreSQLConnection object.

tbl

character; the table to simplify.

tolerance

numeric; the tolerance in meters CHECK THIS

geom.col

character; the geometry column (default; 'geometry')

new.geom.col

character; the name of the geometry column in which new simplified geometry will be written. If identical to geom.col, this one is overwritten (default: geometry_simpl).

verbose

boolean; shall the gain of memory be printed ? (default: TRUE).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(spData)
library(sf)
library(RPostgreSQL)
data(seine)
conn = dbConnect(drv=dbDriver("PostgreSQL"), host="localhost", port=5432,
               dbname="foodflows", user="milo", password="postgres")
dbWriteTable(conn, name="seine", seine, overwrite=TRUE)
pgisSimplifyGeom(conn, "seine", tolerance=10)
pgisSimplifyGeom(conn, "seine", tolerance=100)
pgisSimplifyGeom(conn, "seine", tolerance=1000)
dbDisconnect(conn)

MiloMonnier/postgisr documentation built on Feb. 16, 2021, 8:03 p.m.