GraphHopper.com | Forum | GitHub | Maps | Blog

Include timestamps and OSM ids when generating .res.gpx


#1

Hi guys!

I was able to generate a .res.gpx file by map matching a gpx file with contents like the following:

<trk>
  <trkseg>
    <trkpt lat="1.32508" lon="103.939823">
      <time>2016-11-07T06:48:47Z</time>
    </trkpt>
    <trkpt lat="1.314029" lon="103.949334">
      <time>2016-11-07T06:48:57Z</time>
    </trkpt>
    <trkpt lat="1.314029" lon="103.949334">
      <time>2016-11-07T06:49:07Z</time>
    </trkpt>
    <trkpt lat="1.314029" lon="103.949334">
      <time>2016-11-07T06:49:18Z</time>
    </trkpt>
  </trkseg>
<trk>

The resulting file .res.gpx outputs as follows:

<trk>
  <name>GraphHopper MapMatching</name>
  <trkseg>
    <trkpt lat="1.324726" lon="103.9356">
      <time>1970-01-01T00:00:00Z</time>
    </trkpt>
    <trkpt lat="1.325383" lon="103.940439">
      <time>1970-01-01T00:00:00Z</time>
    </trkpt>
    <trkpt lat="1.325406" lon="103.940555">
      <time>1970-01-01T00:00:00Z</time>
    </trkpt>
    <trkpt lat="1.325572" lon="103.941394">
      <time>1970-01-01T00:00:00Z</time>
    </trkpt>
  </trkseg>
</trk>

I have two questions:

  • I noticed that the timestamps in the result file are all the same. May I know how I can configure the map matcher to include the same timestamps in the .gpx file?
  • I’ve used a .osm.pbf file for the map matcher datasource, with OSM IDs in them. Can I configure the map matcher to include the associated OSM ID per <trkpt> element in the .res.gpx file?

Thanks in advance! :slight_smile:


#2

Hey there, I’ve had a similar issue a few months ago and created my own time interpolation: https://github.com/MAGDa-BeuthHS/fcd2pgsql/blob/master/src/main/java/org/magda_beuth_hs/fcd2pgsql/matching/FCDMatcher.java

The tool cannot parse and wirte GPX-files. But maybe the code helps. About the OSM_ID: Can’t you get this one from the matchinng result (EdgeMatch)?


#3

Hi, thanks for the suggestion. I’m currently taking a look at the MAGDa code.

As for getting the OSM_ID from the matching result, yes we can do this by post-processing the resulting data. We’re just thinking if we can prevent this step by trying to output the OSM IDs in one go (on-the-fly during the map matching).


#4

You could do that but it is currently not done. See related (osm way ID): https://github.com/karussell/graphhopper-osm-id-mapping I wouldn’t use now anymore the way IDs and instead the osm node IDs. Something like this will be added to GH


#5

It’s worth noting that with https://github.com/graphhopper/map-matching/pull/87 there is more integration of the map-matched results with the original GPX entries - e.g. I think you could easily extract the timestamp information you require.


#6

Hey, i have got the same issue. I want only OSM EdgeID’S from gpx data. Can you suggest the solution for me. TIA