db_create_postgis: Create a new PostGIS database to hold data derived from LIDAR...

Description Usage Arguments Details Value See Also

View source: R/dbconnect_functions.R

Description

This function first checks that PostgreSQL version 11 and the PostGIS extension are installed on the local system and available from the command line. It then creates a new database containing the PostGIS extension and the required schemas and tables for data derived from LIDAR images. Note that the PostGIS extension is presently stored in the 'public' schema rather than a separate schema to allow users to connect with ArcMap versions prior to 10.7.1.

Usage

1
2
3
4
5
6
7
8
9
db_create_postgis(
  dbname,
  mga.zones = c(54, 55, 56),
  host = "localhost",
  port = 5432,
  username = "postgres",
  password = NULL,
  pgpath = "c:/Program Files/PostgreSQL/11/bin"
)

Arguments

dbname

Database name.

mga.zones

MGA map zones (two digit integer) for which schema should be created. Presently, only GDA94 map zones 49-56 are supported (EPSG 28349 - 28356). The default is 54:56 for New South Wales map zones.

host

Host name. Defaults to 'localhost'.

port

Port number to use for database commands. Defaults to 5432 which is the default port number for PostgreSQL.

username

User name for this session. Defaults to 'postgres'.

password

Database password for the specified user. If NULL (default) this is taken from the local system environment variable PGPASSWORD.

pgpath

The path to the bin directory of a locally accessible installation of PostgreSQL / PostGIS. Defaults to 'c:/Program Files/PostgreSQL/11/bin'.

Details

Schemas are created for each of the MGA zones to be supported (default: zones 54, 55 and 56). Within each schema, two raster data tables are created to store multi-band rasters of integer point counts within voxels. Each table has two columns: rid: an auto-incremented integer record number; rast raster tiles (i.e. PostGIS storage tiles rather than LAS images). The first table, 'point_counts', holds rasters derived from individual LAS images. The PostGIS tile size for each record corresponds to the dimensions of the input poinit counts raster. The second table, 'point_counts_union', holds rasters that have been mosaiced by summing the values of overlapping edge pixels. The reason for holding duplicate data is to allow for deletion and re-import of data (e.g. to fix problems in a particular LAS tile) that would otherwise be difficult with just the mosaiced data.

A vector data table, 'las_metadata', is created in each schema to store metadata LAS images including source file name, capture date and times, point counts and average point density. The table also has a geometry column for the bounding rectangle of each LAS image.

Records in the 'las_metadata' and 'point_counts' tables are related by a common integer identifier (las_metadata.id = point_counts.metadata_id). No field explicitly links raster records in the point_counts_union table to those in other tables. Instead, records can be related via spatial queries.

Value

A named list of database settings for use with other db_xxx functions.

See Also

db_connect_postgis


mbedward/CERMBlidarpostgis documentation built on Nov. 14, 2021, 7:15 p.m.