Open Lgum opened 2 years ago
This is probably because the current GEOS DiscreteFrechetDistance
algorithm is a recursive one, and so can use a lot of stack.
JTS now has a DiscreteFrechetDistance
implementation which uses an internal stack, and so does not have this problem. It uses a dynamic programming approach which should also be a lot faster. See https://github.com/locationtech/jts/pull/764 and https://github.com/locationtech/jts/pull/783.
When trying to calculate the Frechet distance between two linestrings (each around 1500 segments), I get a segmentation fault on windows 10.
I can avoid this, by specifying the stack reserve size in Visual Studio, and putting it to i.e. 8388608. While this works, larger linestring will potentially crash also unix machines. In this case, a stack size of roughly 3 MiB is enough.
Tested on Windows 10, with Geos 3.10.1, Visual Studio 2019.
The linestrings are attached, the code is as follows:
ls2.csv ls1.csv