Description Usage Arguments References Examples
Rasterize a PostGIS vector table.
1 | pgisRasterizeTable(conn, tbl, name, xref = NULL, yref = NULL, scale = 1000)
|
conn |
a PostgreSQLConnection object. |
tbl |
character; name of the input vector table to rasterize. |
name |
character; name of the output raster table. |
xref |
numeric; x coordinate of reference pixel bottomleft corner. If NULL (default), the center of the extent is taken. |
yref |
numeric; y coordinate of reference pixel bottomleft corner. If NULL (default), the center of the extent is taken. |
scale |
numeric; size of the raster pixels, in meters (default: 1000). |
https://nronnei.github.io/blog/2017/03/creating-rasters-from-scratch-in-postgis/ http://geospatialelucubrations.blogspot.com/2014/05/a-guide-to-rasterization-of-vector.html
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(spData)
library(RPostgreSQL)
library(sf)
data(seine)
Sys.sleep(10)
conn = dbConnect(drv=dbDriver("PostgreSQL"), host="localhost", port=5432,
dbname="foodflows", user="milo", password="postgres")
sf::dbWriteTable(conn, name="seine", seine, overwrite=TRUE)
Sys.sleep(10)
pgisRasterizeTable(conn, "seine", "seine_rast")
Sys.sleep(10)
rast = pgisGetRaster(conn, "seine_rast", flip=TRUE)
raster::plot(rast)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.