diff --git a/lib/cunit/cu_pc_patch_lazperf.c b/lib/cunit/cu_pc_patch_lazperf.c
index 2ffe6f2..4d6b1d5 100644
--- a/lib/cunit/cu_pc_patch_lazperf.c
+++ b/lib/cunit/cu_pc_patch_lazperf.c
@@ -13,7 +13,9 @@
/* GLOBALS ************************************************************/
static PCSCHEMA *simpleschema = NULL;
+static PCSCHEMA *multipledimschema = NULL;
static const char *simplexmlfile = "data/simple-schema.xml";
+static const char *multipledimxmlfile = "data/simple-schema-laz-multiple-dim.xml";
/* Setup/teardown for this suite */
static int
@@ -24,6 +26,11 @@ init_suite(void)
pcfree(xmlstr);
if ( rv == PC_FAILURE ) return 1;
+ xmlstr = file_to_str(multipledimxmlfile);
+ rv = pc_schema_from_xml(xmlstr, &multipledimschema);
+ pcfree(xmlstr);
+ if ( rv == PC_FAILURE ) return 1;
+
return 0;
}
@@ -31,6 +38,7 @@ static int
clean_suite(void)
{
pc_schema_free(simpleschema);
+ pc_schema_free(multipledimschema);
return 0;
}
@@ -281,6 +289,47 @@ test_patch_filter_lazperf_zero_point()
pc_patch_free((PCPATCH*) pa);
pc_pointlist_free(pl);
}
+
+static void
+test_patch_compression_with_multiple_dimension()
+{
+ PCPOINT *pt;
+ int i;
+ int npts = 5;
+ PCPOINTLIST *pl;
+ PCPATCH_LAZPERF *pal;
+ PCPATCH_UNCOMPRESSED *pau;
+ char *str1, *str2;
+
+ // build a list of points
+ pl = pc_pointlist_make(npts);
+
+ for ( i = 0; i < npts; i++ )
+ {
+ pt = pc_point_make(multipledimschema);
+ pc_point_set_double_by_name(pt, "x", i*2);
+ pc_point_set_double_by_name(pt, "y", i*1.9);
+ pc_point_set_double_by_name(pt, "z", i*0.34);
+ pc_point_set_double_by_name(pt, "intensity", 10);
+ pc_pointlist_add_point(pl, pt);
+ }
+
+ // build patchs
+ pal = pc_patch_lazperf_from_pointlist(pl);
+ pau = pc_patch_uncompressed_from_pointlist(pl);
+
+ // compare str result
+ str1 = pc_patch_lazperf_to_string(pal);
+ str2 = pc_patch_uncompressed_to_string(pau);
+
+ CU_ASSERT_STRING_EQUAL(str1, str2);
+
+ pc_patch_free((PCPATCH*) pal);
+ pc_patch_free((PCPATCH*) pau);
+ pc_pointlist_free(pl);
+ pcfree(str1);
+ pcfree(str2);
+}
#endif
/* REGISTER ***********************************************************/
@@ -293,6 +342,7 @@ CU_TestInfo lazperf_tests[] = {
PC_TEST(test_to_string_lazperf),
PC_TEST(test_wkb_lazperf),
PC_TEST(test_patch_filter_lazperf_zero_point),
+ PC_TEST(test_patch_compression_with_multiple_dimension),
#endif
CU_TEST_INFO_NULL
};
diff --git a/lib/cunit/data/simple-schema-laz-multiple-dim.xml b/lib/cunit/data/simple-schema-laz-multiple-dim.xml
new file mode 100644
index 0000000..567a907
--- /dev/null
+++ b/lib/cunit/data/simple-schema-laz-multiple-dim.xml
@@ -0,0 +1,38 @@
+
+
+
+ 1
+ 4
+ X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ X
+ int64_t
+ 0.01
+
+
+ 2
+ 4
+ Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Y
+ double
+ 0.01
+
+
+ 3
+ 4
+ Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Z
+ float
+ 0.01
+
+
+ 4
+ 2
+ 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.
+ Intensity
+ uint64_t
+ 1
+
+
+ laz
+
+
diff --git a/lib/lazperf_adapter.cpp b/lib/lazperf_adapter.cpp
index 8f4b272..d05c097 100644
--- a/lib/lazperf_adapter.cpp
+++ b/lib/lazperf_adapter.cpp
@@ -168,22 +168,25 @@ LazPerf::addField(const PCDIMENSION *dim)
}
case PC_INT64:
{
- //_engine->template add_field();
+ _engine->template add_field();
+ _engine->template add_field();
break;
}
case PC_UINT64:
{
- //_engine->template add_field();
+ _engine->template add_field();
+ _engine->template add_field();
break;
}
case PC_DOUBLE:
{
- //_engine->template add_field();
+ _engine->template add_field();
+ _engine->template add_field();
break;
}
case PC_FLOAT:
{
- //_engine->template add_field();
+ _engine->template add_field();
break;
}
case PC_UNKNOWN:
diff --git a/pgsql/expected/pointcloud-laz.out b/pgsql/expected/pointcloud-laz.out
index ccc9bec..813fa93 100644
--- a/pgsql/expected/pointcloud-laz.out
+++ b/pgsql/expected/pointcloud-laz.out
@@ -273,4 +273,90 @@ SELECT pc_astext(pc_explode(pa)) FROM pa_test_laz;
{"pcid":5,"pt":[6,5.7,1.02,10]}
(4 rows)
+INSERT INTO pointcloud_formats (pcid, srid, schema)
+VALUES (6, 0,
+'
+
+
+ 1
+ 4
+ X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ X
+ int64_t
+ 0.01
+
+
+ 2
+ 4
+ Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Y
+ double
+ 0.01
+
+
+ 3
+ 4
+ Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Z
+ float
+ 0.01
+
+
+ 4
+ 2
+ 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.
+ Intensity
+ uint64_t
+ 1
+
+
+ laz
+
+'
+);
+CREATE TABLE IF NOT EXISTS pa_test_laz_multiple_dim (
+ pa PCPATCH(6)
+);
+\d pa_test_laz_multiple_dim
+Table "public.pa_test_laz_multiple_dim"
+ Column | Type | Modifiers
+--------+------------+-----------
+ pa | pcpatch(6) |
+
+INSERT INTO pa_test_laz_multiple_dim (pa)
+SELECT PC_Patch(PC_MakePoint(6, ARRAY[x,y,z,intensity]))
+FROM (
+ SELECT
+ a*2 AS x,
+ a*1.9 AS y,
+ a*0.34 AS z,
+ 10 AS intensity,
+ a/400 AS gid
+ FROM generate_series(1,1600) AS a
+) AS values GROUP BY gid;
+SELECT pc_astext(pc_explode(pa)) FROM pa_test_laz_multiple_dim LIMIT 20;
+ pc_astext
+---------------------------------------
+ {"pcid":6,"pt":[3200,3040,544,10]}
+ {"pcid":6,"pt":[800,760,136,10]}
+ {"pcid":6,"pt":[802,761.9,136.34,10]}
+ {"pcid":6,"pt":[804,763.8,136.68,10]}
+ {"pcid":6,"pt":[806,765.7,137.02,10]}
+ {"pcid":6,"pt":[808,767.6,137.36,10]}
+ {"pcid":6,"pt":[810,769.5,137.7,10]}
+ {"pcid":6,"pt":[812,771.4,138.04,10]}
+ {"pcid":6,"pt":[814,773.3,138.38,10]}
+ {"pcid":6,"pt":[816,775.2,138.72,10]}
+ {"pcid":6,"pt":[818,777.1,139.06,10]}
+ {"pcid":6,"pt":[820,779,139.4,10]}
+ {"pcid":6,"pt":[822,780.9,139.74,10]}
+ {"pcid":6,"pt":[824,782.8,140.08,10]}
+ {"pcid":6,"pt":[826,784.7,140.42,10]}
+ {"pcid":6,"pt":[828,786.6,140.76,10]}
+ {"pcid":6,"pt":[830,788.5,141.1,10]}
+ {"pcid":6,"pt":[832,790.4,141.44,10]}
+ {"pcid":6,"pt":[834,792.3,141.78,10]}
+ {"pcid":6,"pt":[836,794.2,142.12,10]}
+(20 rows)
+
TRUNCATE pointcloud_formats;
diff --git a/pgsql/expected/pointcloud.out b/pgsql/expected/pointcloud.out
index 4fa56e2..50f6082 100644
--- a/pgsql/expected/pointcloud.out
+++ b/pgsql/expected/pointcloud.out
@@ -537,21 +537,21 @@ ORDER BY compr,sc,v;
compr | 5 | dimensional | zlib | t
compr | 6 | dimensional | zlib | t
compr | 7 | dimensional | zlib | t
- compr | -7 | laz | null | f
- compr | -6 | laz | null | f
- compr | -5 | laz | null | f
- compr | -4 | laz | null | f
- compr | -3 | laz | null | f
- compr | -2 | laz | null | f
- compr | -1 | laz | null | f
- compr | 0 | laz | null | f
- compr | 1 | laz | null | f
- compr | 2 | laz | null | f
- compr | 3 | laz | null | f
- compr | 4 | laz | null | f
- compr | 5 | laz | null | f
- compr | 6 | laz | null | f
- compr | 7 | laz | null | f
+ compr | -7 | laz | null | t
+ compr | -6 | laz | null | t
+ compr | -5 | laz | null | t
+ compr | -4 | laz | null | t
+ compr | -3 | laz | null | t
+ compr | -2 | laz | null | t
+ compr | -1 | laz | null | t
+ compr | 0 | laz | null | t
+ compr | 1 | laz | null | t
+ compr | 2 | laz | null | t
+ compr | 3 | laz | null | t
+ compr | 4 | laz | null | t
+ compr | 5 | laz | null | t
+ compr | 6 | laz | null | t
+ compr | 7 | laz | null | t
(75 rows)
SELECT PC_Summary(PC_Compress(PC_Patch(PC_MakePoint(10,ARRAY[1,1,1,1,1,1,1])),
diff --git a/pgsql/sql/pointcloud-laz.sql b/pgsql/sql/pointcloud-laz.sql
index 33ef7c1..cf37c1e 100644
--- a/pgsql/sql/pointcloud-laz.sql
+++ b/pgsql/sql/pointcloud-laz.sql
@@ -95,4 +95,65 @@ INSERT INTO pa_test_laz( pa ) VALUES ('01050000000300000004000000210000000000000
SELECT pc_explode(pa) FROM pa_test_laz;
SELECT pc_astext(pc_explode(pa)) FROM pa_test_laz;
+INSERT INTO pointcloud_formats (pcid, srid, schema)
+VALUES (6, 0,
+'
+
+
+ 1
+ 4
+ X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ X
+ int64_t
+ 0.01
+
+
+ 2
+ 4
+ Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Y
+ double
+ 0.01
+
+
+ 3
+ 4
+ Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.
+ Z
+ float
+ 0.01
+
+
+ 4
+ 2
+ 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.
+ Intensity
+ uint64_t
+ 1
+
+
+ laz
+
+'
+);
+
+CREATE TABLE IF NOT EXISTS pa_test_laz_multiple_dim (
+ pa PCPATCH(6)
+);
+\d pa_test_laz_multiple_dim
+
+INSERT INTO pa_test_laz_multiple_dim (pa)
+SELECT PC_Patch(PC_MakePoint(6, ARRAY[x,y,z,intensity]))
+FROM (
+ SELECT
+ a*2 AS x,
+ a*1.9 AS y,
+ a*0.34 AS z,
+ 10 AS intensity,
+ a/400 AS gid
+ FROM generate_series(1,1600) AS a
+) AS values GROUP BY gid;
+
+SELECT pc_astext(pc_explode(pa)) FROM pa_test_laz_multiple_dim LIMIT 20;
+
TRUNCATE pointcloud_formats;