diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000..eab8fc4 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,30 @@ +Copyright (c) 2012, OpenGeo +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +Neither the name of the OpenGeo nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b7f508 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +# pointcloud + +MODULE_big = pointcloud +OBJS= pc_core.o + +EXTENSION = pointcloud +DATA = pointcloud--1.0.sql + +REGRESS = pointcloud + +SHLIB_LINK += $(filter -lm, $(LIBS)) + +# We are going to use PGXS for sure +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) + diff --git a/README.md b/README.md index 16e12e9..6cf8d31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -pointcloud -========== +Point Cloud +=========== + +A PostgreSQL extension for storing point cloud (LIDAR) data. + +Requires +======== + +- PostgreSQL 9.1+ (support for extensions) +- PostgreSQL compiled --with-xml -A PostgreSQL extension for storing point cloud (LIDAR) data. \ No newline at end of file diff --git a/pc_core.c b/pc_core.c new file mode 100644 index 0000000..f62d7ac --- /dev/null +++ b/pc_core.c @@ -0,0 +1,10 @@ +/*********************************************************************** +* pc_core.c +* +* Core routines for point clouds +* +* Portions Copyright (c) 2012, OpenGeo +* +***********************************************************************/ + +#include "pc_core.h" \ No newline at end of file diff --git a/pc_core.h b/pc_core.h new file mode 100644 index 0000000..6458a1b --- /dev/null +++ b/pc_core.h @@ -0,0 +1,46 @@ +/*********************************************************************** +* pc_core.h +* +* Structures and function signatures for point clouds +* +* Portions Copyright (c) 2012, OpenGeo +* +***********************************************************************/ + +/* PostgreSQL types and functions */ +#include "postgres.h" + +/** +* Point type for clouds. Variable length, because there can be +* an arbitrary number of dimensions. The pcid is a foreign key +* reference to the POINTCLOUD_REFERENCE_SYSTEMS table, where +* the underlying structure of the data is described in XML, +* the spatial reference system is indicated, and the data +* packing scheme is indicated. +*/ +typedef struct +{ + uint32 size; /* PgSQL VARSIZE */ + uint16 pcid; + uint8 data[1]; +} PCPOINT; + + +/** +* Generic patch type (collection of points) for clouds. +* Variable length, because there can be +* an arbitrary number of points encoded within. +* The pcid is a foriegn key reference to the +* POINTCLOUD_REFERENCE_SYSTEMS table, where +* the underlying structure of the data is described in XML, +* the spatial reference system is indicated, and the data +* packing scheme is indicated. +*/ +typedef struct +{ + uint32 size; /* PgSQL VARSIZE */ + uint16 pcid; + uint32 npoints; + uint8 data[1]; +} PCPATCH; + diff --git a/pointcloud--1.0.sql b/pointcloud--1.0.sql new file mode 100644 index 0000000..d32a55f --- /dev/null +++ b/pointcloud--1.0.sql @@ -0,0 +1,21 @@ + +-- complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION pointcloud" to load this file. \quit + +-- We need this for every point cloud, so we won't bury it in the XML +CREATE DOMAIN pointcloud_compression AS TEXT +CHECK ( + VALUE = 'GHT' OR + VALUE = 'NONE' +); + + +-- Metadata table describing contents of pcpoints +CREATE TABLE pointcloud_formats ( + pcid INTEGER PRIMARY KEY, + srid INTEGER, -- REFERENCE spatial_ref_sys(srid) + compression pointcloud_compression, + format XML +); +-- Register pointcloud_formats table so the contents are included in pg_dump output +SELECT pg_catalog.pg_extension_config_dump('pointcloud_formats', ''); \ No newline at end of file diff --git a/pointcloud.control b/pointcloud.control new file mode 100644 index 0000000..188fdf0 --- /dev/null +++ b/pointcloud.control @@ -0,0 +1,7 @@ +# pointcloud extension +comment = 'data type for lidar point clouds' +default_version = '1.0' +module_pathname = '$libdir/pointcloud' +relocatable = true +superuser = true +#requires = 'postgis'