I want to snap the GPX-track to the road network as the image below shows. I found out, that "Hausdorff Distance" is exactly what I need and that it is usable with PostGIS. But unfortunately I have no idea how to work with it and even I don't know where to start. I'm not very familiar with PostGIS.

How do I use ST_HausdorffDistance (http://postgis.net/docs/ST_HausdorffDistance.html)? Is there any tutorial or workshop?

Im using qgis. The road-network comes from OSM (osm2pgsql).

enter image description here

  • 1
    ST_Snap postgis.net/docs/ST_Snap.html would be a better choice?
    – Mapperz
    Oct 11, 2014 at 21:43
  • That seem to be a better approach. But I really have no Idea, how to perform the script. I'm not familiar with sql-scripting. And the examples at postgis.net/docs/ST_Snap.html are not helping me. I have two sql tables: one (planet_osm_lines from osm2pgsql) and one (track_table) I made from a gpx-file. I need the result as a new polyline in "track_table".
    – MartinMap
    Oct 13, 2014 at 8:39
  • Here is an example to use PostGIS with ST_Snap gis.stackexchange.com/questions/52232/…
    – Mapperz
    Oct 14, 2014 at 13:29

1 Answer 1


Let me respectfully disagree, but I don't think that the Hausdorff distance function is the appropriate way to snap a GPX track to a street network. Rather you should be looking into methods for map matching, e.g.

Different approaches for map matching : links / ideas?

  • I found in that post, that "Hausdorff Distance" could be the right thing for me - but now it seems, it isnt :-)
    – MartinMap
    Oct 13, 2014 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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