# How to rank polylines according to their similarity to a ref polyline?

How to rank polylines according to their similarity to a ref polyline?

Update 1: simulations show that simple $\sqrt{\sum{(case-ref)^2}}$ can find better similarity between polylines (as set of points) than Hausdorff distance! but not satisfied yet! (right-click >> view image >> for full resolution)

Given your description, there are a few measures that you could use. If the data is time varying (i.e. those polylines are really tracks and you are comparing them to a reference route), you could use something like a simple root-sum-squares to get a good measure.

A more "geo" approach, then Hausdorff distance is a good metric. Its supported in GEOS and JTS, so lots of free software tools (e.g. postgis and spatialite) support it using simple function calls. It may not be a great approach if you have a track that has a lot of "fairly large" excursions, and another track that has one huge excursion and is otherwise pretty good.

You may also want to apply some filtering to this data if its recorded from noisy sensors - a momentary recording "glitch" could make a lot of difference in this kind of "reduce to a single number" assessment.

• what are you meaning with root-sum-squares? – nkint Apr 17 '13 at 17:49