Description Usage Arguments Examples
Creates into PostGIS database a raster covering a given extent, with a given pixel size (scale).
1 | pgisCreateRaster(conn, tbl, extent, scale = 1000)
|
conn |
a PostgreSQLConnection object. |
tbl |
character; name of the created table (default: rastertest). |
extent |
spatial extent covered by the raster. Can be either a bbox class objet, a sf object, or the name of a PostGIS table (default: NULL). |
scale |
numeric; size of the raster pixels, in meters (default: 1000). |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(spData)
library(sf)
library(RPostgreSQL)
library(raster)
data(seine) # CRS is in meters
# Create a raster of 5km resolution pixel covering french seine river
conn = dbConnect(drv=dbDriver("PostgreSQL"), host="localhost", port=5432,
dbname="foodflows", user="milo", password="postgres")
pgisCreateRaster(conn, "rastertest", extent=seine, scale=5000)
# Check
rast = pgisGetRaster(conn, "rastertest")
values(rast) = rnorm(ncell(rast))
plot(rast)
plot(st_geometry(seine), add=TRUE)
dbDisconnect(conn)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.