Right now code calculates the distances between all the points many times in a nested loops which gets really inefficient as a number of points grow.
I would suggest two things:
To simplify calculations, use projected coordinates: https://wiki.openstreetmap.org/wiki/Mercator that way you can get distances the normal euclidean way (as inverse square of yada yada)
That way you can store one set of points in index (let's say OSM stops for example) and later for every GTFS stop find neighboring OSM Stops using index like queryRange(<30m box around gtfs stop>) and process found stops further.
By further processing I mean that just a closest point might not be good enough, we will have to do more check on possible candidates, but let's address that in a separate issue.
I will try changing the distance matching algorithm and the use of quad tree. I am still working on figuring out how to handle the bus stop conflicts which may arise due to name issues etc.
Right now code calculates the distances between all the points many times in a nested loops which gets really inefficient as a number of points grow.
I would suggest two things:
That way you can store one set of points in index (let's say OSM stops for example) and later for every GTFS stop find neighboring OSM Stops using index like
queryRange(<30m box around gtfs stop>)
and process found stops further.By further processing I mean that just a closest point might not be good enough, we will have to do more check on possible candidates, but let's address that in a separate issue.