[pgpointcloud] PC_NumPoints

Lars laasunde at hotmail.com
Thu Jun 21 23:53:32 PDT 2018


Thanks for your response.

You are right about returning null. Will consider your proposal.

________________________________
Fra: Éric Lemoine <eric.lemoine at oslandia.com>
Sendt: tirsdag 12. juni 2018 16.52
Til: Lars; pgpointcloud at lists.osgeo.org
Emne: Re: [pgpointcloud] PC_NumPoints

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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20180622/54684a1f/attachment.html>


More information about the pgpointcloud mailing list