[geos-devel] millions of lines intersection against single polygon

Andrew Bell andrew.bell.ia at gmail.com
Thu Jun 25 10:03:04 PDT 2020


On Thu, Jun 25, 2020 at 2:55 AM Nyall Dawson <nyall.dawson at gmail.com> wrote:

> Hi list!
>
> I've a situation where I've got ~millions of lines (each consisting of
> a single segment only) which I need to intersect against a complex
> polygon.
>
> Trying the naive way of multiple calls to GEOSIntersection_r gives
> predictably horrendous performance. Is there a better way I can
> approach this situation using the GEOS c api?
>

There's an algorithm in PDAL that does this for point-in-polygon, but all
the guts are there to do segment intersections. You're welcome to take it
and modify to your liking:

https://github.com/PDAL/PDAL/tree/master/filters/private/pnp

How much better it would from a more brute-force approach depends a lot on
the data.

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20200625/76ed0d8a/attachment.html>


More information about the geos-devel mailing list