[pdal] Fwd: EPT points in polygon with the C++ API

Balázs Dukai B.Dukai at tudelft.nl
Wed Feb 5 05:27:55 PST 2020


Fantastic, thank you for the quick answer!

I implemented what you suggested, initializing the reader, options and 
filters within the loop and it works.

I haven't mentioned in my original email, but I'm using version 2.0.1. 
In this version I haven't seen the `polygon` option on the EPT reader 
and when I try to use PDAL tells me that its not a valid option. So I 
added a CropFilter with the `polygon` extent, and I also use `bounds` on 
the reader.

Thank you!
Balázs

On 04-02-2020 15:59, Andrew Bell wrote:
>
>
> On Tue, Feb 4, 2020 at 6:43 AM Balázs Dukai <B.Dukai at tudelft.nl 
> <mailto:B.Dukai at tudelft.nl>> wrote:
>
>
>     1. My primary, technical question is how to reset the "bounds"
>     Option on
>     a Reader in a loop?
>
>
> You don't.  Just start over every time.  prepare() does processing to 
> prepare the query from the EPT source.  You need make sure it's 
> executed for each query.  Probably easiest is just to recreate the 
> reader/pipeline in some function for each bounding box.
>
>     2. A more "meta" question is if the process above is sensible and
>     efficient in terms of PDAL API use for a retrieving the points
>     within a
>     given polygon, for many many polygons :-)?
>
>
> If you're retrieving things from EPT through PDAL, yes.  The EPT spec 
> is public and you're welcome to write your own implementation that 
> does exactly what you want.
>
>     3. For the time being we have our own point-in-polygon
>     implementation,
>     hence I'm only querying the EPT for the bounding boxes of the
>     polygons.
>     Once the points in the bbox are retrieved, we do the actual
>     point-in-polygon test. But I've been looking into the Crop Filter to
>     eventually completely replace our point-in-polygon implementation. As
>     far as I understand I would need to feed the Crop Filter with the
>     WKT of
>     the polygon, which would have some overhead for casting
>     back-and-forth
>     to WKT. Is the Crop Filter a reasonable choice for replacing the
>     point-in-polygon query in the process above?
>
>
> The PDAL EPT reader will do this for you.  See the `polygon` option.  
> The PDAL point-in-polygon algorithm seems to be better than most.  
> It's optimized for checking many points in a polygon.  I believe that 
> the algorithm source is documented in the code.
>
> -- 
> Andrew Bell
> andrew.bell.ia at gmail.com <mailto:andrew.bell.ia at gmail.com>
>
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.osgeo.org_mailman_listinfo_pdal&d=DwIGaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=PgA3UFniLNch3v0S8NNLnwqZxhbJDfo4c3-MU-HmzOI&m=0ZD0HTx2NYT1UxW-E65VvflW2nJhkVfdWDyH1Kmu7z8&s=J3QW1ZZTEHQb9iZGQmBNE_OaI7MzC5duMAiJg1SnI5Y&e=


More information about the pdal mailing list