pgMakePts | R Documentation |
Add a new POINT or LINESTRING geometry field.
pgMakePts(
conn,
name,
colname = "geom",
x = "x",
y = "y",
srid,
index = TRUE,
display = TRUE,
exec = TRUE
)
pgMakeStp(
conn,
name,
colname = "geom",
x = "x",
y = "y",
dx = "dx",
dy = "dy",
srid,
index = TRUE,
display = TRUE,
exec = TRUE
)
conn |
A connection object. |
name |
A character string specifying a PostgreSQL schema and
table name (e.g., |
colname |
A character string specifying the name of the new geometry column. |
x |
The name of the x/longitude field. |
y |
The name of the y/latitude field. |
srid |
A valid SRID for the new geometry. |
index |
Logical. Whether to create an index on the new geometry. |
display |
Logical. Whether to display the query (defaults to
|
exec |
Logical. Whether to execute the query (defaults to
|
dx |
The name of the dx field (i.e. increment in x direction). |
dy |
The name of the dy field (i.e. increment in y direction). |
If exec = TRUE
, returns TRUE
if the geometry
field was successfully created.
Mathieu Basille mathieu@basille.org
The PostGIS documentation for ST_MakePoint
:
http://postgis.net/docs/ST_MakePoint.html, and for
ST_MakeLine
:
http://postgis.net/docs/ST_MakeLine.html, which are the
main functions of the call.
## Examples use a dummy connection from DBI package
conn <- DBI::ANSI()
## Create a new POINT field called 'pts_geom'
pgMakePts(conn, name = c("schema", "table"), colname = "pts_geom",
x = "longitude", y = "latitude", srid = 4326, exec = FALSE)
## Create a new LINESTRING field called 'stp_geom'
pgMakeStp(conn, name = c("schema", "table"), colname = "stp_geom",
x = "longitude", y = "latitude", dx = "xdiff", dy = "ydiff",
srid = 4326, exec = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.