Giter Site home page Giter Site logo

Comments (14)

karussell avatar karussell commented on September 17, 2024

Do you have example(s) to reproduce this?

from map-matching.

florianschmidt1994 avatar florianschmidt1994 commented on September 17, 2024

Yes e.g. my input files is looking something like this:

    ...
      <trkpt lat="51.03170000" lon="13.71301000">
        <ele>137.00000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:01:01Z</time>
      </trkpt>
     ...

and my output file is missing all properties expect the updated lat, lon, and time

    ...
    <trkpt lat="51.032245" lon="13.710442"><time>1970-01-01T01:00:00+01:00</time></trkpt>
    ....

from map-matching.

karussell avatar karussell commented on September 17, 2024

If I have something reproducable in a unit test or the full file where you really see the problem, chances are higher that I can faster fix it :)

from map-matching.

florianschmidt1994 avatar florianschmidt1994 commented on September 17, 2024

Just going to post my input gpx and output gpx, i'm going to add some details on how to reproduce later. (Actually i did just follow the instructions in the readme)
To my understanding the input file should be a valid gpx file, where each trackpoint has a description and a link.
Unfortunately the output file is missing the description and link.

Input gpx (=before.gpx)

<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - asd" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">
  <metadata>
    <name>asd</name>
    <link href="http://www.gpsies.com/">
      <text>asd on GPSies.com</text>
    </link>
    <time>2015-04-21T17:28:55Z</time>
  </metadata>
  <trk>
    <name>asd on GPSies.com</name>
    <trkseg>
      <trkpt lat="51.03232000" lon="13.71077000">
        <ele>136.60000</ele>
        <desc>Some description here</desc>
        <time>2010-01-01T00:00:00Z</time>
      </trkpt>
      <trkpt lat="51.03170000" lon="13.71301000">
        <ele>137.00000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:01:01Z</time>
      </trkpt>
      <trkpt lat="51.03076000" lon="13.71417000">
        <ele>137.80000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:01:49Z</time>
      </trkpt>
      <trkpt lat="51.03021000" lon="13.71635000">
        <ele>141.80000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:02:48Z</time>
      </trkpt>
      <trkpt lat="51.02911000" lon="13.71797000">
        <ele>143.60000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:03:48Z</time>
      </trkpt>
      <trkpt lat="51.02876000" lon="13.71879000">
        <ele>145.00000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:04:13Z</time>
      </trkpt>
      <trkpt lat="51.02957000" lon="13.72074000">
        <ele>145.20000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:05:12Z</time>
      </trkpt>
      <trkpt lat="51.02988000" lon="13.72207000">
        <ele>145.80000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:05:47Z</time>
      </trkpt>
      <trkpt lat="51.02958000" lon="13.72277000">
        <ele>147.30000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:06:09Z</time>
      </trkpt>
      <trkpt lat="51.02979000" lon="13.72456000">
        <ele>146.40000</ele>
        <desc>Some description here</desc>
        <link>Some link here</link>
        <time>2010-01-01T00:06:55Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Output (=before.gpx.res.gpx)

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creator="Graphhopper" version="1.1" xmlns:gh="https://graphhopper.com/public/schema/gpx/1.1">
<metadata><copyright author="OpenStreetMap contributors"/><link href="http://graphhopper.com"><text>GraphHopper GPX</text></link><time>1970-01-01T01:00:00+01:00</time></metadata>
<trk><name>GraphHopper MapMatching</name><trkseg>
<trkpt lat="51.032245" lon="13.710442"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032216" lon="13.710586"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032124" lon="13.710791"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032279" lon="13.710969"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032359" lon="13.711108"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032295" lon="13.711252"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032132" lon="13.711576"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.032035" lon="13.711791"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031926" lon="13.71204"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031887" lon="13.712119"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031807" lon="13.712297"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031777" lon="13.712364"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031584" lon="13.712795"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031452" lon="13.713086"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031389" lon="13.713227"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031256" lon="13.713523"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.03125" lon="13.713537"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031197" lon="13.713655"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031082" lon="13.713909"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.031014" lon="13.714061"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030993" lon="13.714107"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030942" lon="13.714222"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030807" lon="13.714521"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030714" lon="13.71473"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030555" lon="13.715088"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030509" lon="13.71519"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030475" lon="13.715267"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030379" lon="13.715484"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030357" lon="13.715531"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030351" lon="13.715546"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030253" lon="13.715765"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030221" lon="13.715838"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030133" lon="13.716036"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030006" lon="13.71632"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029952" lon="13.716441"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029786" lon="13.716748"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029758" lon="13.716808"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029725" lon="13.716884"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029649" lon="13.717058"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029561" lon="13.717253"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029455" lon="13.717493"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029442" lon="13.717521"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029331" lon="13.717795"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029282" lon="13.717916"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029254" lon="13.717974"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029069" lon="13.718398"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029005" lon="13.718487"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.028971" lon="13.718522"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.028836" lon="13.718666"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.028804" lon="13.7187"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029257" lon="13.719965"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.02969" lon="13.721255"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029727" lon="13.721364"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030046" lon="13.722299"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030764" lon="13.724326"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.030582" lon="13.724389"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029799" lon="13.724589"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.029779" lon="13.724206"><time>1970-01-01T01:00:00+01:00</time></trkpt>
<trkpt lat="51.02976" lon="13.723841"><time>1970-01-01T01:00:00+01:00</time></trkpt></trkseg></trk></gpx>

from map-matching.

karussell avatar karussell commented on September 17, 2024

Ah, okay. Yes, this would be nice to have and should not be hard to implement - maybe you give it a try?

from map-matching.

leoroos avatar leoroos commented on September 17, 2024

This is not an easy problem since multiple input points might be processed to produce a single output point or no input points at all have been used to produce a single output point.

So you need to make a decision which input point meta information you want to reuse on a single output point.
If there are multiple maybe put the meta information of all input points on a single output point.
If there are no direct input points for that single output, maybe backfill with the information from other output points.
It might also make sense to calculate an average value from the meta information for one specific output point.

Perhaps a generic approach should be to provide some kind of configurable hook, that allows to reattach meta-information.

from map-matching.

karussell avatar karussell commented on September 17, 2024

There is already the concept of 'EdgeMatch' where one can set a list of GPXExtensions where one of them is a GPXEntry and a queryResult but others could be added there as well if one has the input data. Surely we should provide such a simple hook.

from map-matching.

zeromem avatar zeromem commented on September 17, 2024

Is there any progress on this issue?
I am a new user of GraphHopper Map Matching, and I encounter the same issue.
I want to keep time information in output gpx file.
as this post shows, the output gpx file's items are always zero.
as @leoroos said, It's hard to decide a good timestamp for each output GPX entry.
@karussell can you provide more details of EdgeMatch and GPXExtensions?

from map-matching.

karussell avatar karussell commented on September 17, 2024

Is there any progress on this issue?

We do not work on this yet.

@karussell can you provide more details of EdgeMatch and GPXExtensions?

See the duplicate/related issue #64

from map-matching.

karussell avatar karussell commented on September 17, 2024

Similarly this would be nice if such a relationship is created for the new path details feature

from map-matching.

imtypist avatar imtypist commented on September 17, 2024

Will you solve this issue? I encounter the same problem, I want to keep timestamp in output gpx files, at least for those origin points.
Can I simply calculate the distance of origin_point and output_point, and add timestamp to those nearest ones?
@karussell

from map-matching.

michaz avatar michaz commented on September 17, 2024

Okay, let's do this.

Problem 1 (data processing):
Even though the API may look like it should transform one <gpx ...></...> to another <gpx ...></...> by taking <trkpt ...></...> and moving them around by, like, manipulating the DOM, this is not what's happening. We really just take the XML, parse the points out, throw the rest away, map-match, sample the resulting route at node locations, wrap that in some XML tags and return that. *)

Problem 2 (semantics):
What's in a track? Even though we describe map-matching as "snapping points to roads", what it does is calculate the most likely route through the road network given the points.

Input: Track (sequence of (x,y,t))
Output: Route (path through the road graph)

  1. It's not so clear (to me) how individual points of the input track should be mapped to points on the output route. Our algorithm does actually work by taking input points and "snapping" them to the road, but

a) it could work differently. I'm not sure any notion of snapping is definitive for map-matching.
b) it doesn't do it with all of the input points, but can choose to disregard some, when they don't add any information the algorithm can use.

Especially b) I'm not sure how to deal with.

  1. We currently take the output Route and generate two things from it, a <trk ...></...> and a <rte ...></...>. The former is basically like what you plot on your web map when you get a route from GraphHopper: It just contains all the points you need to draw it. The latter is a bit more sparse and contains only the points at which the driving directions would be given, like "turn left".

As @leoroos was saying, how would we "embed" the "snapped" input points there? In the <trk ...></...> probably, but the mapping can't be 1:1, we may have to insert extra points, because the input Track may be sparse! Maybe it just contains points every 2 kilometers. Then, just the set of snapped points is not what you are asking for, you want enough information to see what roads were supposedly taken.

So we would have to mix snapped original points and extra points. But then there's a new problem: The Route that we calculate has its own idea of how fast it is, and we currently put that information in the output. If we would, say, keep the timestamps of the input points and insert time-less extra points in between, that information would be gone. (It would still be in the <rte ...></...>, though).

Maybe that's the solution to that part of the problem: We make the <rte ...></...> to be what is currently the <trk ...></...>, i.e. add more points to it. So then instructions are only on some of them, fine, and if you want to draw something, this is what you draw. Then we can use the <trk ...></...> for something that matches (parts of the) input and retains the attributes.

*) In the GPX API. The library function underneath, and the alternative output formats, work somewhat differently.

from map-matching.

michaz avatar michaz commented on September 17, 2024

@zeromem

as this post shows, the output gpx file's items are always zero.

That, at least, is fixed.

from map-matching.

DahnJ avatar DahnJ commented on September 17, 2024

@michaz

The Route that we calculate has its own idea of how fast it is, and we currently put that information in the output.

This information does not show for me in the output, is there a way to enable this? Thank you

(I'm using commit 8e0cd26c88bdca96428f015a0e6daf33f72a3e5c )

from map-matching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.