amillb / pgMapMatch

map-matching of GPS traces
MIT License
75 stars 20 forks source link

Issues when running test cases #8

Closed ShuyaoHong closed 6 years ago

ShuyaoHong commented 6 years ago

First of all, thanks for building a great open-source map-matching library!

I tried to run the built-in test cases and had to change few places in mapmatcher.py to make it run successfully. Without further investigation, I am not sure if these are due to my configuration/packages versions (PostgreSQL 9.6, pgRouting 2.4.1). So instead of doing a pull request, I will just list the issues I encountered below fyi.

  1. ST_LineLocatePoint's 1st argument wrong type throwing "ERROR: line_locate_point: 1st arg isn't a line". I replaced all "_STLineLocatePoint(%(streetGeomCol)s" with "_ST_LineLocatePoint(STLineMerge(%(streetGeomCol)s)", following this suggestion here: https://gis.stackexchange.com/a/95263.

  2. This code block may have two seperate issues: https://github.com/amillb/pgMapMatch/blob/d4dc9413ddf533ff76f6d8a7cd33e85f7404ec53/mapmatcher.py#L670-L672

    • id2 is undefined.

    • there is one extra argument passed to pgr_dijkstra which throws type errors.

    I changed it to:

    cmd = '''SELECT array_agg(edge) AS edges FROM pgr_dijkstra(
     'SELECT %(streetIdCol)s, %(source)s, %(target)s, %(cost)s, %(reverse_cost)s FROM %(streetsTable)s', %(oNode)s, %(dNode)s, True);
  3. A rather minor issue with tests.py: The expected uturnFrcs for _testtrace65.gpx case is slightly different (after 10 decimal places..) from what I got from the test run, which might due to the difference between latest OSM network and the version when the expected result is generated.

    • Expected:

    https://github.com/amillb/pgMapMatch/blob/d4dc9413ddf533ff76f6d8a7cd33e85f7404ec53/tests.py#L45

    • What I got: 'testtrace_36Uturns.gpx':[-1]*20+[(0.0341696793**913362**, 0.3423193020**70578**), -1, -1]

After three changes above, I can run the tests successfully.

amillb commented 6 years ago

Thanks for the issues and the resolutions. I appreciate the careful documentation, and will work them into the next update.