Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate the similarity of two polylines #12

Open
mjaschen opened this issue Mar 4, 2016 · 1 comment
Open

Calculate the similarity of two polylines #12

mjaschen opened this issue Mar 4, 2016 · 1 comment
Labels

Comments

@mjaschen
Copy link
Owner

mjaschen commented Mar 4, 2016

An algorithm for calculating the similarity between two given polylines should be implemented.

Idea:

  • create a corridor area around the first polyline (with configurable corridor width); a polygon instance can be used for this (check: what happens if the polyline crosses itself?)
  • check how much of the second polyline is located within the corridor
  • the result is a floating point number between 0 and 1; 0 means that no parts of the second polyline are located within the corridor and 1 means that the second line ist located entirely within the corridor
  • additionally provide a check if the directions of both polylines are the same

Sounds reasonable?

@TheCelavi
Copy link

What is the real-world appliance? Like, if vehicle/someone follows some path when traveling?

If you decide to add support for GEOS (like https://geophp.net/geos.html), there is "within" function, so when you construct a corridor, you can easily check if polyline is within polygon.

However, you can have issue there if you are trying to determine if object follows a "one way" path.

Let say that there is a path A-B-C-D, so you want to check if object follows that path. With function "within" object can go A-B-C-B-C-B-D and you will get result that evaluates to "true".

There are additional issues related to "path following problem" which has to be considered, but I can not explain them without drawing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants