[pgpointcloud] PC_NumPoints

Éric Lemoine eric.lemoine at oslandia.com
Tue Jun 12 07:52:16 PDT 2018


On Tue, 2018-06-12 at 09:08 +0000, Lars wrote:
> Hello list,
> 
> The query (below) produces count equal 1  as expected.
> select pc_numpoints(pc_filterbetween(pa, 'x', 100.4140, 100.4151)) as
> count from testdata;
> 
> Tweaking the query slightly and the query produces count equal " "
> (no number displayed). The expected count is 0.
> select pc_numpoints(pc_filterbetween(pa, 'x', 100.4140, 100.4150)) as
> count from testdata;
> 
> It looks like a bug that pc_numpoints is able to return a non-integer 
> value.

I am not sure. In this case pc_filterbetween doesn't return an empty
patch. It returns a NULL value instead. That is why pc_numpoints
returns a NULL value.

You can always use coalesce to change NULL to something else:

select coalesce(pc_numpoints(pc_filterbetween(pa, 'x', 100.4140,
100.4150)), 0) as count from testdata;

> 
> This issue also applies to PC_PatchXXX functions that also return " "
> (no number) in the case the input is empty. Not sure what the correct
> return value should be in these cases.
> 
> Just a minor thing, it would be nice if the documentation for
> PC_FilterBetween made it clear that between means greater than value1
> and less than values2. I made the mistake of thinking it was greater
> than or equal to value1 and less than or equal to value2.

Agree, I'll amend the doc for that.


-- 
Éric Lemoine
Oslandia
+33 1 86 95 95 55
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20180612/6facafef/attachment.sig>


More information about the pgpointcloud mailing list