Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

enter image description here

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)

enter image description here

share|improve this question
What do you need the metric for? Is something with a few big excursions worse than something that has a lot of small excursions from reference? – BradHards Dec 19 '12 at 8:53
Thank you, indeed. Exactly what you said. Lots of small excursions are negligible, but a few big excursions never. – Developer Dec 19 '12 at 9:10
Can you explain what more you need? – BradHards Dec 20 '12 at 23:44
@BradHards: Sure. The simulation consisted of: a series of random numbers as ref (len=100), 10000 realizations of random series (same size). Objective to find best match through 10000 to ref. Error check the cumulative sum of differences. Also finally visual inspection was applied. Shown that often |d| is better than HD. But not always! Furthermore, visual and numeric methods do not agree always! Goal is to find a numeric measure broadly reliable. – Developer Dec 21 '12 at 0:09
What is the reality you are trying to simulate? What is the random number distribution? – BradHards Dec 21 '12 at 0:37

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.

share|improve this answer
what are you meaning with root-sum-squares? – nkint Apr 17 '13 at 17:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.