I am developing a car-sharing application and I want to check if the approach I have is correct. I am using Postgres with PostGIS.
I have a list of routes that users publish, where they indicate that they typically commute from a point A to a point B (i.e. I am going from Milan to Venezia). All those routes are saved in the database as polylines that represent user journeys.
Then I need to search all those routes giving an input route (the red line in the picture), looking for routes that intersect my input or are close by (let's say 10 km deviation).
My solution is to convert everything to linestrings
and use the Hausdorff distance to get close paths. Since I am fairly new to this approach, before proceeding further I have some doubt:
- Is this approach computationally feasible?
- Does it take into account the direction of the two polylines?
- Is it a good approximation of "similar" routes?
- Are there optimizations I can do to improve the overall search?