Open greenscientist opened 6 months ago
We'll have to list all operations that make use of this local spatial index and move them closer to the database (ie in the backend if they are potentially run in the frontend) so they can benefit from it. Then we can remove this index.
Adding this to the Path refactoring milestone, as it implies revisiting those geographic collection to make them smaller (and thus maybe not sufficient for the required location operations)
One note though, the local indexes are sometimes used to index data that is not yet in the database. For example, when importing GTFS stops, when we aggregate new stops with existing ones, we use this local index, then add new ones or update some after moving their position a little to the centroid of the aggregated nodes.
Only at the end of all node import do we save them in the database. The stop aggregation algorithm will need to be revisited if we want to use postgis.
Proposal:
kdbush
still, or some function of turf
)The advantage of this approach is that is prioritizes aggregating the stops being imported rather than the currently existing nodes, which may have been imported with different aggregation distances and thus may separate two related nodes, which are close by in the current import, but may be aggregated to different original nodes.
We might want to revisit the whole agregation concept. Maybe we could save all node data as "raw" node without any agregation. We could then maybe have an addition layer, "NodeAgregated" that we use when we really need to do operation on agreagated nodes.
We might want to revisit the whole agregation concept. Maybe we could save all node data as "raw" node without any agregation. We could then maybe have an addition layer, "NodeAgregated" that we use when we really need to do operation on agreagated nodes.
True, because if you import a stop with a radius of 0, you don't want the next import, with radius of 60, to move your precious node! Which is what is currently happening...
The GenericPlaceCollection class create its own spatial index to store points in memory. We should not have to do that kind of operations in Typescript, we have a powerful spatial database optimized for that!