postgresqlPackages.pointcloud: init at 1.2.5 (#454969)

This commit is contained in:
Wolfgang Walther
2025-10-28 09:19:06 +00:00
committed by GitHub
2 changed files with 179 additions and 0 deletions
@@ -0,0 +1,124 @@
{
autoconf,
automake,
cunit,
fetchFromGitHub,
fetchpatch,
installShellFiles,
lib,
libtool,
libxml2,
perl,
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
postgresqlTestHook,
sphinx,
which,
zlib,
}:
postgresqlBuildExtension (finalAttrs: {
pname = "pointcloud";
version = "1.2.5";
outputs = [
"out"
"man"
];
src = fetchFromGitHub {
owner = "pgpointcloud";
repo = "pointcloud";
tag = "v${finalAttrs.version}";
hash = "sha256-uFbScxq21kt0jOjjyfMeO3i+bG2/kWS/Rrt3ZpOqEns=";
};
nativeBuildInputs = [
autoconf
automake
installShellFiles
libtool
perl
# for doc
sphinx
# needed by the configure phase
which
];
buildInputs = [
zlib
];
doCheck = !(postgresqlTestHook.meta.broken);
checkInputs = [
cunit
];
nativeCheckInputs = [
postgresql
postgresqlTestHook
];
preConfigure = ''
./autogen.sh
'';
configureFlags = [
(lib.withFeatureAs true "xml2config" (lib.getExe' (lib.getDev libxml2) "xml2-config"))
];
postInstall = ''
cd doc
make man
installManPage build/man/pgpointcloud.1
'';
passthru.tests = {
extension = postgresqlTestExtension {
inherit (finalAttrs) finalPackage;
# see https://pgpointcloud.github.io/pointcloud/concepts/schemas.html
withPackages = [ "postgis" ];
sql = builtins.readFile ./tests.sql;
asserts = [
{
query = "pc_version()";
expected = "'${lib.versions.major finalAttrs.version}.${lib.versions.minor finalAttrs.version}.${lib.versions.patch finalAttrs.version}'";
description = "pc_version() returns correct values.";
}
{
query = "pc_postgis_version()";
expected = "'${lib.versions.major finalAttrs.version}.${lib.versions.minor finalAttrs.version}.${lib.versions.patch finalAttrs.version}'";
description = "pc_postgis_version() returns correct values.";
}
# these tests are taken from the documentation of respective methods
{
query = "SELECT PC_AsText('010100000064CEFFFF94110000703000000400'::pcpoint)";
expected = "'{\"pcid\":1,\"pt\":[-127,45,124,4]}'";
description = "Creating a point and displaying as text returns correct string";
}
{
query = "SELECT ST_AsText(PC_MakePoint(1, ARRAY[-127, 45, 124.0, 4.0])::geometry)";
expected = "'POINT Z (-127 45 124)'";
description = "Casting a pcpoint to a postgis geometry works";
}
];
};
};
meta = {
description = "PostgreSQL extension for storing point cloud (LIDAR) data";
longDescription = ''
# pgPointcloud - A PostgreSQL extension for storing point cloud (LIDAR) data.
LIDAR point cloud are becoming more and more available. Devices are easy to get, not too expensive, and provide very accurate 3D points. pgPointCLoud is an open source PostgreSQL extension for storing point cloud data and use it with PostGIS. It is very easy to use, robust and efficient.
By storing LIDAR points in a PostgreSQL database, pgPointcloud eases many problems and allows a good integration with other geo-spatial data (vector, raster) into one common framework : PostGIS.
'';
homepage = "https://pgpointcloud.github.io/pointcloud/";
changelog = "https://github.com/pgpointcloud/pointcloud/blob/v${finalAttrs.version}/NEWS";
license = lib.licenses.bsd3;
teams = [ lib.teams.geospatial ];
inherit (postgresql.meta) platforms;
};
})
@@ -0,0 +1,55 @@
CREATE EXTENSION pointcloud;
CREATE EXTENSION pointcloud_postgis CASCADE;
INSERT INTO pointcloud_formats
(pcid, srid, schema) VALUES (
1,
4326,
'<?xml version="1.0" encoding="UTF-8"?>
<pc:PointCloudSchema xmlns:pc="http://pointcloud.org/schemas/PC/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pc:dimension>
<pc:position>1</pc:position>
<pc:size>4</pc:size>
<pc:description>X coordinate as a long integer. You must use the
scale and offset information of the header to
determine the double value.</pc:description>
<pc:name>X</pc:name>
<pc:interpretation>int32_t</pc:interpretation>
<pc:scale>0.01</pc:scale>
</pc:dimension>
<pc:dimension>
<pc:position>2</pc:position>
<pc:size>4</pc:size>
<pc:description>Y coordinate as a long integer. You must use the
scale and offset information of the header to
determine the double value.</pc:description>
<pc:name>Y</pc:name>
<pc:interpretation>int32_t</pc:interpretation>
<pc:scale>0.01</pc:scale>
</pc:dimension>
<pc:dimension>
<pc:position>3</pc:position>
<pc:size>4</pc:size>
<pc:description>Z coordinate as a long integer. You must use the
scale and offset information of the header to
determine the double value.</pc:description>
<pc:name>Z</pc:name>
<pc:interpretation>int32_t</pc:interpretation>
<pc:scale>0.01</pc:scale>
</pc:dimension>
<pc:dimension>
<pc:position>4</pc:position>
<pc:size>2</pc:size>
<pc:description>The intensity value is the integer representation
of the pulse return magnitude. This value is optional
and system specific. However, it should always be
included if available.</pc:description>
<pc:name>Intensity</pc:name>
<pc:interpretation>uint16_t</pc:interpretation>
<pc:scale>1</pc:scale>
</pc:dimension>
<pc:metadata>
<Metadata name="compression">dimensional</Metadata>
</pc:metadata>
</pc:PointCloudSchema>'
);