mirror of
https://github.com/pgpointcloud/pointcloud.git
synced 2025-12-08 20:36:04 +00:00
Merge branch 'master' into filtershortcut
This commit is contained in:
commit
643fcd29ca
21
README.md
21
README.md
@ -2,6 +2,8 @@
|
||||
|
||||
A PostgreSQL extension for storing point cloud (LIDAR) data.
|
||||
|
||||
- Mailing list: http://lists.osgeo.org/mailman/listinfo/pgpointcloud/
|
||||
|
||||
|
||||
## Build/Install ##
|
||||
|
||||
@ -549,23 +551,21 @@ The only issues to watch when creating WKB patches are: ensuring the data you wr
|
||||
|
||||
#### Build and Install PDAL ####
|
||||
|
||||
Support for PostgreSQL Pointcloud in PDAL is currently brand-new and will have to be [built from source](http://www.pointcloud.org/compilation/index.html). The PostgresSQL Pointcloud driver uses the "soci" module for database read/write, which can be difficult to compile. Future versions will convert to using the `libpq` PostgreSQL client libraries directly, for a simpler install.
|
||||
Support for PostgreSQL Pointcloud has been added to PDAL. It is in most recent builds, but if you want the latest version, you can [build from source](http://www.pointcloud.org/compilation/index.html).
|
||||
|
||||
First, you will need to install the many, many dependencies of PDAL.
|
||||
|
||||
- Read the compilation instructions: http://www.pointcloud.org/compilation/index.html
|
||||
- Read the dependency information: http://www.pointcloud.org/compilation/dependencies.html
|
||||
- Install the "boost" package if your system has one
|
||||
- Install the "soci" add-on for boost, and ensure the PgSQL plug-in is built: http://soci.sourceforge.net/
|
||||
- Install the "proj4" library: https://trac.osgeo.org/proj/
|
||||
- Install the "geos" library: https://trac.osgeo.org/geos/
|
||||
- Install the "geotiff" library: http://trac.osgeo.org/geotiff/
|
||||
- Install the "gdal" library: http://gdal.org/
|
||||
- Install the "liblas" library: http://liblas.org/
|
||||
|
||||
Then, clone the Pointcloud PDAL repository, that contains the latest version of the Pointcloud driver for PDAL (as well as the latest version of PDAL itself):
|
||||
Then, clone the PDAL repository:
|
||||
|
||||
- Clone into a source directory: `git clone https://github.com/pramsey/PDAL PDAL`
|
||||
- Clone into a source directory: `git clone https://github.com/PDAL/PDAL PDAL`
|
||||
- Make a build directory: `mkdir PDAL-build`
|
||||
- Enter the build directory: `cd PDAL-build`
|
||||
- Run CMake to find dependencies: `cmake ../PDAL`
|
||||
@ -574,17 +574,17 @@ Then, clone the Pointcloud PDAL repository, that contains the latest version of
|
||||
- Once CMake has found all dependencies, run the build: `make all`
|
||||
- And install the artifacts: `make install`
|
||||
|
||||
If all the dependencies were found, including the `soci` driver for PostgreSQL, you're ready to run a PDAL import into PostgreSQL Pointcloud!
|
||||
If all the dependencies were found, you're ready to run a PDAL import into PostgreSQL Pointcloud!
|
||||
|
||||
#### Running `pcpipeline` ####
|
||||
|
||||
PDAL includes a limited command-line program, `pc2pc` that does simple transformations, but in order to load data into Pointcloud we use a "PDAL pipeline". A pipeline combines a format reader, and format writer, with filters that can alter or group the points together.
|
||||
PDAL includes a `command linen program <http://www.pointcloud.org/apps.html>`_ that allows both simple format translations and more complex "pipelines" of transformation. The `pdal translate` does simple format transformations. In order to load data into Pointcloud we use a "PDAL pipeline", by calling `pdal pipeline`. A pipeline combines a format reader, and format writer, with filters that can alter or group the points together.
|
||||
|
||||
PDAL pipelines are XML files, which nest together readers, filters, and writers into a processing chain that will be applied to the LIDAR data.
|
||||
|
||||
To execute a pipeline file, run it through the `pcpipeline` command:
|
||||
|
||||
pcpipeline pipelinefile.xml
|
||||
pdal pipeline --input pipelinefile.xml
|
||||
|
||||
Here is a simple example pipeline that reads a LAS file and writes into a PostgreSQL Pointcloud database.
|
||||
|
||||
@ -595,9 +595,8 @@ Here is a simple example pipeline that reads a LAS file and writes into a Postgr
|
||||
<Option name="table">sthsm</Option>
|
||||
<Option name="srid">26910</Option>
|
||||
<Filter type="filters.chipper">
|
||||
<Option name="capacity">400</Option>
|
||||
<Filter type="filters.cache"><Option name="max_cache_blocks">3</Option>
|
||||
<Option name="cache_block_size">32184</Option>
|
||||
<Option name="capacity">600</Option>
|
||||
<Filter type="filters.cache">
|
||||
<Reader type="drivers.las.reader">
|
||||
<Option name="filename">/home/lidar/st-helens-small.las</Option>
|
||||
<Option name="spatialreference">EPSG:26910</Option>
|
||||
|
||||
@ -13,6 +13,7 @@ CUNIT_LDFLAGS = @CUNIT_LDFLAGS@
|
||||
GHT_CPPFLAGS = @GHT_CPPFLAGS@
|
||||
GHT_LDFLAGS = @GHT_LDFLAGS@
|
||||
|
||||
PG_CONFIG = @PG_CONFIG@
|
||||
PGXS = @PGXS@
|
||||
|
||||
LIB_A = libpc.a
|
||||
45
configure.ac
45
configure.ac
@ -64,11 +64,11 @@ AC_CHECK_HEADER([CUnit/CUnit.h], [
|
||||
AC_CHECK_LIB([cunit],
|
||||
[CU_initialize_registry],
|
||||
[CUNIT_LDFLAGS="$LDFLAGS -lcunit"],
|
||||
[AC_MSG_ERROR([could not locate CUnit required for unit tests])]
|
||||
[AC_MSG_RESULT([notice C unit tests will not be run])]
|
||||
)
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([could not locate CUnit required for unit tests])
|
||||
AC_MSG_RESULT([notice C unit tests will not be run])
|
||||
])
|
||||
|
||||
AC_SUBST([CUNIT_CPPFLAGS])
|
||||
@ -81,25 +81,25 @@ dnl ===========================================================================
|
||||
|
||||
AC_ARG_WITH([pgconfig],
|
||||
[AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file])],
|
||||
[PGCONFIG="$withval"], [PGCONFIG=""])
|
||||
[PG_CONFIG="$withval"], [PG_CONFIG=""])
|
||||
|
||||
if test "x$PGCONFIG" = "x"; then
|
||||
dnl PGCONFIG was not specified, so search within the current path
|
||||
AC_PATH_PROG([PGCONFIG], [pg_config])
|
||||
if test "x$PG_CONFIG" = "x"; then
|
||||
dnl PG_CONFIG was not specified, so search within the current path
|
||||
AC_PATH_PROG([PG_CONFIG], [pg_config])
|
||||
|
||||
dnl If we couldn't find pg_config, display an error
|
||||
if test "x$PGCONFIG" = "x"; then
|
||||
if test "x$PG_CONFIG" = "x"; then
|
||||
AC_MSG_ERROR([could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.])
|
||||
fi
|
||||
else
|
||||
dnl PGCONFIG was specified; display a message to the user
|
||||
if test "x$PGCONFIG" = "xyes"; then
|
||||
dnl PG_CONFIG was specified; display a message to the user
|
||||
if test "x$PG_CONFIG" = "xyes"; then
|
||||
AC_MSG_ERROR([you must specify a parameter to --with-pgconfig, e.g. --with-pgconfig=/path/to/pg_config])
|
||||
else
|
||||
if test -f $PGCONFIG; then
|
||||
AC_MSG_RESULT([Using user-specified pg_config file: $PGCONFIG])
|
||||
if test -f $PG_CONFIG; then
|
||||
AC_MSG_RESULT([Using user-specified pg_config file: $PG_CONFIG])
|
||||
else
|
||||
AC_MSG_ERROR([the user-specified pg_config file $PGCONFIG does not exist])
|
||||
AC_MSG_ERROR([the user-specified pg_config file $PG_CONFIG does not exist])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -112,24 +112,25 @@ dnl packages, but don't install the Makefile it points to unless
|
||||
dnl the postgresql-server-dev packages are installed :)
|
||||
dnl ===========================================================================
|
||||
|
||||
PGXS=`$PGCONFIG --pgxs`
|
||||
PGXS=`$PG_CONFIG --pgxs`
|
||||
if test ! -f $PGXS; then
|
||||
AC_MSG_ERROR([the PGXS Makefile $PGXS cannot be found. Please install the PostgreSQL server development packages and re-run configure.])
|
||||
fi
|
||||
|
||||
AC_SUBST([PG_CONFIG])
|
||||
AC_SUBST([PGXS])
|
||||
|
||||
dnl Extract the version information from pg_config
|
||||
dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
|
||||
dnl the final version. This is to guard against user error...
|
||||
PGSQL_MAJOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
|
||||
PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
|
||||
PGSQL_FULL_VERSION=`$PGCONFIG --version`
|
||||
PGSQL_MAJOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
|
||||
PGSQL_MINOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
|
||||
PGSQL_FULL_VERSION=`$PG_CONFIG --version`
|
||||
PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
|
||||
|
||||
PGSQL_PKGLIBDIR=`$PGCONFIG --pkglibdir`
|
||||
PGSQL_LIBDIR=`$PGCONFIG --libdir`
|
||||
PGSQL_SHAREDIR=`$PGCONFIG --sharedir`
|
||||
PGSQL_PKGLIBDIR=`$PG_CONFIG --pkglibdir`
|
||||
PGSQL_LIBDIR=`$PG_CONFIG --libdir`
|
||||
PGSQL_SHAREDIR=`$PG_CONFIG --sharedir`
|
||||
|
||||
AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
|
||||
dnl Ensure that we are using PostgreSQL >= 9.0
|
||||
@ -138,8 +139,8 @@ if test ! "$PGSQL_MAJOR_VERSION" -ge 9; then
|
||||
fi
|
||||
|
||||
dnl Extract the linker and include flags for the frontend (for programs that use libpq)
|
||||
PGSQL_FE_LDFLAGS=-L`$PGCONFIG --libdir`" -lpq"
|
||||
PGSQL_FE_CPPFLAGS=-I`$PGCONFIG --includedir`
|
||||
PGSQL_FE_LDFLAGS=-L`$PG_CONFIG --libdir`" -lpq"
|
||||
PGSQL_FE_CPPFLAGS=-I`$PG_CONFIG --includedir`
|
||||
|
||||
AC_SUBST([PGSQL_FE_LDFLAGS])
|
||||
AC_SUBST([PGSQL_FE_CPPFLAGS])
|
||||
@ -292,7 +293,7 @@ AC_MSG_RESULT([ -------------- Compiler Info ------------- ])
|
||||
AC_MSG_RESULT([ C compiler: ${CC} ${CFLAGS}])
|
||||
AC_MSG_RESULT()
|
||||
AC_MSG_RESULT([ -------------- Dependencies -------------- ])
|
||||
AC_MSG_RESULT([ PostgreSQL config: ${PGCONFIG}])
|
||||
AC_MSG_RESULT([ PostgreSQL config: ${PG_CONFIG}])
|
||||
AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_FULL_VERSION}])
|
||||
AC_MSG_RESULT([ Libxml2 config: ${XML2CONFIG}])
|
||||
AC_MSG_RESULT([ Libxml2 version: ${LIBXML2_VERSION}])
|
||||
|
||||
@ -15,6 +15,18 @@ OBJS = \
|
||||
cu_pc_patch.o \
|
||||
cu_pc_patch_ght.o
|
||||
|
||||
ifeq ($(CUNIT_LDFLAGS),)
|
||||
# No cunit? Emit message and continue
|
||||
|
||||
all:
|
||||
@echo "CUnit not found, skipping build"
|
||||
|
||||
check:
|
||||
@echo "CUnit not found, skipping tests"
|
||||
|
||||
else
|
||||
# Yes cunit? Build tests and run
|
||||
|
||||
# Build the unit tester
|
||||
all: $(EXE)
|
||||
|
||||
@ -22,6 +34,8 @@ all: $(EXE)
|
||||
check: $(EXE)
|
||||
@./$(EXE)
|
||||
|
||||
endif
|
||||
|
||||
# Build the main unit test executable
|
||||
$(EXE): $(OBJS) ../$(LIB_A)
|
||||
$(CC) -o $@ $^ $(LDFLAGS) -lm
|
||||
@ -33,3 +47,4 @@ $(EXE): $(OBJS) ../$(LIB_A)
|
||||
clean:
|
||||
@rm -f $(OBJS)
|
||||
@rm -f $(EXE)
|
||||
|
||||
|
||||
@ -280,4 +280,5 @@ void pc_bitmap_filter(PCBITMAP *map, PC_FILTERTYPE filter, int i, double d, doub
|
||||
|
||||
|
||||
|
||||
#endif /* _PC_API_INTERNAL_H */
|
||||
#endif /* _PC_API_INTERNAL_H */
|
||||
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
|
||||
#undef HAVE_LIBGHT
|
||||
#undef HAVE_LIBGHT
|
||||
|
||||
|
||||
@ -137,4 +137,5 @@ pc_dimstats_update(PCDIMSTATS *pds, const PCPATCH_DIMENSIONAL *pdl)
|
||||
}
|
||||
}
|
||||
return PC_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -604,4 +604,5 @@ pc_pointlist_from_ght(const PCPATCH_GHT *pag)
|
||||
PCPATCH_UNCOMPRESSED *pu;
|
||||
pu = pc_patch_uncompressed_from_ght(pag);
|
||||
return pc_pointlist_from_uncompressed(pu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -313,4 +313,5 @@ void pc_bounds_merge(PCBOUNDS *b1, const PCBOUNDS *b2)
|
||||
if ( b2->ymin < b1->ymin ) b1->ymin = b2->ymin;
|
||||
if ( b2->xmax > b1->xmax ) b1->xmax = b2->xmax;
|
||||
if ( b2->ymax > b1->ymax ) b1->ymax = b2->ymax;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,7 +206,15 @@ stringbuffer_avprintf(stringbuffer_t *s, const char *fmt, va_list ap)
|
||||
|
||||
/* Propogate errors up */
|
||||
if ( len < 0 )
|
||||
{
|
||||
#if defined(__MINGW64_VERSION_MAJOR)
|
||||
/* Assume windows flaky vsnprintf that returns -1 if */
|
||||
/* initial buffer too small and add more space */
|
||||
len = _vscprintf(fmt, ap2);
|
||||
#else
|
||||
return len;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We didn't have enough space! */
|
||||
/* Either Unix vsnprint returned write length larger than our buffer */
|
||||
|
||||
@ -75,4 +75,5 @@ extern char stringbuffer_lastchar(stringbuffer_t *s);
|
||||
extern int stringbuffer_trim_trailing_white(stringbuffer_t *s);
|
||||
extern int stringbuffer_trim_trailing_zeroes(stringbuffer_t *s);
|
||||
|
||||
#endif /* _STRINGBUFFER_H */
|
||||
#endif /* _STRINGBUFFER_H */
|
||||
|
||||
|
||||
@ -940,6 +940,16 @@ pc_patch_to_geometry_wkb_envelope(const SERIALIZED_PATCH *pa, const PCSCHEMA *sc
|
||||
int has_srid = false;
|
||||
size_t size = 1 + 4 + 4 + 4 + 2*npoints*8; /* endian + type + nrings + npoints + 5 dbl pts */
|
||||
|
||||
/* Bounds! */
|
||||
double xmin = pa->bounds.xmin;
|
||||
double ymin = pa->bounds.ymin;
|
||||
double xmax = pa->bounds.xmax;
|
||||
double ymax = pa->bounds.ymax;
|
||||
|
||||
/* Make sure they're slightly bigger than a point */
|
||||
if ( xmin == xmax ) xmax += xmax * 0.0000001;
|
||||
if ( ymin == ymax ) ymax += ymax * 0.0000001;
|
||||
|
||||
if ( schema->srid > 0 )
|
||||
{
|
||||
has_srid = true;
|
||||
|
||||
@ -214,40 +214,40 @@ SELECT Min(PC_PatchMin(pa,'z')) FROM pa_test_dim;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS pa_test_ght (
|
||||
pa PCPATCH(5)
|
||||
);
|
||||
\d pa_test_ght
|
||||
|
||||
INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050008');
|
||||
INSERT INTO pa_test_ght (pa) VALUES ('000000000500000000000000020000000600000007000000050006000000090000000A00000005000A');
|
||||
INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050003');
|
||||
INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050001');
|
||||
|
||||
SELECT Sum(PC_NumPoints(pa)) FROM pa_test_ght;
|
||||
SELECT Sum(PC_MemSize(pa)) FROM pa_test_ght;
|
||||
SELECT Sum(PC_PatchMax(pa,'x')) FROM pa_test_ght;
|
||||
SELECT Sum(PC_PatchMin(pa,'x')) FROM pa_test_ght;
|
||||
|
||||
DELETE FROM pa_test_ght;
|
||||
INSERT INTO pa_test_ght (pa)
|
||||
SELECT PC_Patch(PC_MakePoint(5, ARRAY[x,y,z,intensity]))
|
||||
FROM (
|
||||
SELECT
|
||||
-127+a/100.0 AS x,
|
||||
45+a/100.0 AS y,
|
||||
1.0*a AS z,
|
||||
a/10 AS intensity,
|
||||
a/400 AS gid
|
||||
FROM generate_series(1,1600) AS a
|
||||
) AS values GROUP BY gid;
|
||||
|
||||
SELECT Sum(PC_NumPoints(pa)) FROM pa_test_ght;
|
||||
SELECT Sum(PC_MemSize(pa)) FROM pa_test_ght;
|
||||
|
||||
SELECT Max(PC_PatchMax(pa,'x')) FROM pa_test_ght;
|
||||
SELECT Min(PC_PatchMin(pa,'x')) FROM pa_test_ght;
|
||||
SELECT Min(PC_PatchMin(pa,'z')) FROM pa_test_ght;
|
||||
-- CREATE TABLE IF NOT EXISTS pa_test_ght (
|
||||
-- pa PCPATCH(5)
|
||||
-- );
|
||||
-- \d pa_test_ght
|
||||
--
|
||||
-- INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050008');
|
||||
-- INSERT INTO pa_test_ght (pa) VALUES ('000000000500000000000000020000000600000007000000050006000000090000000A00000005000A');
|
||||
-- INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050003');
|
||||
-- INSERT INTO pa_test_ght (pa) VALUES ('0000000005000000000000000200000002000000030000000500060000000200000003000000050001');
|
||||
--
|
||||
-- SELECT Sum(PC_NumPoints(pa)) FROM pa_test_ght;
|
||||
-- SELECT Sum(PC_MemSize(pa)) FROM pa_test_ght;
|
||||
-- SELECT Sum(PC_PatchMax(pa,'x')) FROM pa_test_ght;
|
||||
-- SELECT Sum(PC_PatchMin(pa,'x')) FROM pa_test_ght;
|
||||
--
|
||||
-- DELETE FROM pa_test_ght;
|
||||
-- INSERT INTO pa_test_ght (pa)
|
||||
-- SELECT PC_Patch(PC_MakePoint(5, ARRAY[x,y,z,intensity]))
|
||||
-- FROM (
|
||||
-- SELECT
|
||||
-- -127+a/100.0 AS x,
|
||||
-- 45+a/100.0 AS y,
|
||||
-- 1.0*a AS z,
|
||||
-- a/10 AS intensity,
|
||||
-- a/400 AS gid
|
||||
-- FROM generate_series(1,1600) AS a
|
||||
-- ) AS values GROUP BY gid;
|
||||
--
|
||||
-- SELECT Sum(PC_NumPoints(pa)) FROM pa_test_ght;
|
||||
-- SELECT Sum(PC_MemSize(pa)) FROM pa_test_ght;
|
||||
--
|
||||
-- SELECT Max(PC_PatchMax(pa,'x')) FROM pa_test_ght;
|
||||
-- SELECT Min(PC_PatchMin(pa,'x')) FROM pa_test_ght;
|
||||
-- SELECT Min(PC_PatchMin(pa,'z')) FROM pa_test_ght;
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user