Skip to content

Commit 62acf84

Browse files
committed
PC_Envelope_AsBinary -> bytea, PC_Envelope -> geometry
1 parent f044097 commit 62acf84

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@ Now that you have created two tables, you'll see entries for them in the `pointc
276276
>
277277
> 1
278278
279-
**PC_Envelope(p pcpatch)** returns **bytea**
279+
**PC_Envelope_AsBinary(p pcpatch)** returns **bytea**
280280

281281
> Return the OGC "well-known binary" format for *bounds* of the patch.
282282
> Useful for performing intersection tests with geometries.
283283
>
284-
> SELECT PC_Envelope(pa) FROM patches LIMIT 1;
284+
> SELECT PC_Envelope_AsBinary(pa) FROM patches LIMIT 1;
285285
>
286286
> \x0103000000010000000500000090c2f5285cbf5fc0e17a
287287
> 14ae4781464090c2f5285cbf5fc0ec51b81e858b46400ad7
@@ -519,6 +519,11 @@ The `pointcloud_postgis` extension adds functions that allow you to use PostgreS
519519
>
520520
> POINT Z (-127 45 124)
521521
522+
**PC_Envelope(pcpatch)** returns **geometry**<br/>
523+
**pcpatch::geometry** returns **geometry**
524+
525+
> Get the PcPatch bounds as a PostGIS geometry
526+
522527
## Compressions ##
523528

524529
One of the issues with LIDAR data is that there is a lot of it. To deal with data volumes, PostgreSQL Pointcloud allows schemas to declare their preferred compression method in the `<pc:metadata>` block of the schema document. In the example schema, we declared our compression as follows:

pgsql/expected/pointcloud.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ SELECT PC_AsText(pa) FROM pa_test;
291291
{"pcid":1,"pts":[[0.06,0.07,0.05,6],[0.09,0.1,0.05,10]]}
292292
(4 rows)
293293

294-
SELECT PC_Envelope(pa) from pa_test;
295-
pc_envelope
294+
SELECT PC_Envelope_AsBinary(pa) from pa_test;
295+
pc_envelope_asbinary
296296
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
297297
\x01010000007b14ae47e17a943fb81e85eb51b89e3f
298298
\x01030000000100000005000000b81e85eb51b8ae3fec51b81e85ebb13fb81e85eb51b8ae3f9a9999999999b93f0ad7a3703d0ab73f9a9999999999b93f0ad7a3703d0ab73fec51b81e85ebb13fb81e85eb51b8ae3fec51b81e85ebb13f

pgsql/pc_inout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ Datum pcpoint_as_bytea(PG_FUNCTION_ARGS)
294294
PG_RETURN_BYTEA_P(wkb);
295295
}
296296

297-
PG_FUNCTION_INFO_V1(pcpatch_bytea_envelope);
298-
Datum pcpatch_bytea_envelope(PG_FUNCTION_ARGS)
297+
PG_FUNCTION_INFO_V1(pcpatch_envelope_as_bytea);
298+
Datum pcpatch_envelope_as_bytea(PG_FUNCTION_ARGS)
299299
{
300300
uint8 *bytes;
301301
size_t bytes_size;

pgsql/pointcloud.sql.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ CREATE OR REPLACE FUNCTION PC_AsText(p pcpatch)
194194
RETURNS text AS 'MODULE_PATHNAME', 'pcpatch_as_text'
195195
LANGUAGE 'c' IMMUTABLE STRICT;
196196

197-
CREATE OR REPLACE FUNCTION PC_Envelope(p pcpatch)
198-
RETURNS bytea AS 'MODULE_PATHNAME', 'pcpatch_bytea_envelope'
197+
CREATE OR REPLACE FUNCTION PC_Envelope_AsBinary(p pcpatch)
198+
RETURNS bytea AS 'MODULE_PATHNAME', 'pcpatch_envelope_as_bytea'
199199
LANGUAGE 'c' IMMUTABLE STRICT;
200200

201201
CREATE OR REPLACE FUNCTION PC_Uncompress(p pcpatch)

pgsql/sql/pointcloud.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ INSERT INTO pa_test (pa) VALUES ('0000000001000000000000000200000006000000070000
228228
SELECT PC_Uncompress(pa) FROM pa_test LIMIT 1;
229229

230230
SELECT PC_AsText(pa) FROM pa_test;
231-
SELECT PC_Envelope(pa) from pa_test;
231+
SELECT PC_Envelope_AsBinary(pa) from pa_test;
232232
SELECT PC_AsText(PC_Union(pa)) FROM pa_test;
233233
SELECT sum(PC_NumPoints(pa)) FROM pa_test;
234234

pgsql_postgis/pointcloud_postgis--1.0.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ CREATE OR REPLACE FUNCTION PC_Intersection(pcpatch, geometry)
1616
-----------------------------------------------------------------------------
1717
-- Cast from pcpatch to polygon
1818
--
19-
CREATE OR REPLACE FUNCTION geometry(pcpatch)
19+
CREATE OR REPLACE FUNCTION PC_Envelope(pcpatch)
2020
RETURNS geometry AS
2121
$$
22-
SELECT ST_GeomFromEWKB(PC_Envelope($1))
22+
SELECT ST_GeomFromEWKB(PC_Envelope_AsBinary($1))
2323
$$
2424
LANGUAGE 'sql';
2525

26-
CREATE CAST (pcpatch AS geometry) WITH FUNCTION geometry(pcpatch);
26+
CREATE CAST (pcpatch AS geometry) WITH FUNCTION PC_Envelope(pcpatch);
2727

2828
-----------------------------------------------------------------------------
2929
-- Cast from pcpoint to point
@@ -44,7 +44,7 @@ CREATE CAST (pcpoint AS geometry) WITH FUNCTION geometry(pcpoint);
4444
CREATE OR REPLACE FUNCTION PC_Intersects(pcpatch, geometry)
4545
RETURNS boolean AS
4646
$$
47-
SELECT ST_Intersects($2, geometry($1))
47+
SELECT ST_Intersects($2, PC_Envelope($1))
4848
$$
4949
LANGUAGE 'sql';
5050

0 commit comments

Comments
 (0)