Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road switch to early. #141

Open
stoecker opened this issue Dec 6, 2019 · 5 comments
Open

Road switch to early. #141

stoecker opened this issue Dec 6, 2019 · 5 comments

Comments

@stoecker
Copy link

stoecker commented Dec 6, 2019

First: Thanks a lot for that software.

I'm using current Git version with Geofabrik Germany/Brandburg dataset from this week and default settings as delivered. Output as slimjson.

When I pass points to barefoot then when switching to a new road it properly adds the intersection point of the roads. But the road ID passed with the point data switches already one or more points before the intersection (as if the width of the road is taken into account).

A small remark, I also wonder why a single road-id is split into multiple linestrings in the result. I understand that a single real road is split into multiple road-ids, but for each road-id I don't see a necessarity for the split in the result.

Below is an example containing road ID first and linestring as delivered behind. At the end a picture indicating the relevant points.

516661 LINESTRING (13,373969043479710 52,505148184754674, 13,373943700000000 52,505104000000000, 13,373825568194480 52,504910036807890)
516662 LINESTRING (13,373825568194480 52,504910036807890, 13,373736200000000 52,504763300000000, 13,373686431716648 52,504670538462705)
516662 LINESTRING (13,373686431716648 52,504670538462705, 13,373586613573337 52,504484489321730)
516662 LINESTRING (13,373586613573337 52,504484489321730, 13,373534026076370 52,504386471817130)
516662 LINESTRING (13,373534026076370 52,504386471817130, 13,373518097582213 52,504356782706154)

one too early

263390 LINESTRING (13,373518097582213 52,504356782706154, 13,373431300000000 52,504195000000000, 13,373238062036464 52,504382743126506)
263390 LINESTRING (13,373238062036464 52,504382743126506, 13,373238062036464 52,504382743126506)
263390 LINESTRING (13,373238062036464 52,504382743126506, 13,373147678784875 52,504470555616820)
263390 LINESTRING (13,373147678784875 52,504470555616820, 13,373107800000000 52,504509300000000, 13,372937998458735 52,504629606708160)
263390 LINESTRING (13,372937998458735 52,504629606708160, 13,372737232348596 52,504771851070720)
463374 LINESTRING (13,372737232348596 52,504771851070720, 13,372682400000000 52,504810700000000, 13,372589316678742 52,504858450612595)
463374 LINESTRING (13,372589316678742 52,504858450612595, 13,372394342105368 52,504958469625315)
463374 LINESTRING (13,372394342105368 52,504958469625315, 13,372228000000002 52,505043800000010)
463374 LINESTRING (13,372228000000002 52,505043800000010, 13,372228000000002 52,505043800000010)

tow to early

306233 LINESTRING (13,372228000000002 52,505043800000010, 13,372228000000000 52,505043800000000, 13,372162000000000 52,505073300000000, 13,372080000000000 52,505106800000000, 13,372138499999998 52,505195899999990)
306233 LINESTRING (13,372138499999998 52,505195899999990, 13,372138500000000 52,505195900000000, 13,372144406305143 52,505220492646040)
306233 LINESTRING (13,372144406305143 52,505220492646040, 13,372150100000000 52,505244200000000, 13,372173483731652 52,505341465195960)

early_change

@smattheis
Copy link

Few questions:

  1. Is this an offline map matching use case? (I assume so if you use the slimjson output but just for clarity.)
  2. In comparison to your sample output, what is the output you'd expect?
  3. Could you also please provide some input data to reproduce the output? (The shorter the sample sequence the better.) Best in the json format to simply submit it to the matcher/tracker.

@smattheis
Copy link

Maybe this is a misconception of the output. Please note that the output consists of linestrings where each linestring represents the path TO the matched position on the road which means the END point of each linestring indicates the matched position. As an example, let's select some coordinates of the output and put them on the map:

  • END point of LAST linestring with road id 516662 = START point of FIRST linestring with road id 263390, which is (yellow marker) 13,373518097582213 52,504356782706154
  • END point of FIRST linestring with road id 263390 is (green marker) 13,373238062036464 52,504382743126506
  • END point of LAST linestring with road id 463374 = START point of FIRST linestring with road id 306233 which is (blue marker) 13,372228000000002 52,505043800000010
  • END point of FIRST linestring with road id 306233 is (red marker) 13,372173483731652 52,505341465195960

That looks all quite reasonable:

CapturFiles-Dec-08-2019_21 03 21

Please verify it yourself with the following geojson snippet on geojson.io.
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.373518097582213,
          52.504356782706154
        ]
      },
      "properties": {
        "marker-color": "#eeda00",
        "marker-size": "medium",
        "marker-symbol": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.373238062036464,
          52.504382743126506
        ]
      },
      "properties": {
        "marker-color": "#00a225",
        "marker-size": "medium",
        "marker-symbol": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.372228000000002,
          52.50504380000001
        ]
      },
      "properties": {
        "marker-color": "#0010f4",
        "marker-size": "medium",
        "marker-symbol": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.372138499999998,
          52.505195899999990
        ]
      },
      "properties": {
        "marker-color": "#ff0000",
        "marker-size": "medium",
        "marker-symbol": ""
      }
    }
  ]
}

@stoecker
Copy link
Author

stoecker commented Dec 9, 2019

Few questions:

Is this an offline map matching use case? (I assume so if you use the slimjson output but just for clarity.)

Yes. Actually it is near-realtime and I use offline mode. Probably online would be better, but I currently have no time for that.

I want to know on which streets the vehicle drove, so I pass the points as input and use the road id to extract street-data from database.

In comparison to your sample output, what is the output you'd expect?

I would expect that a linestring with an road-id is completely on that road, i.e. that the road-id change happens at the intersection and not shortly before the intersection. Currently I can't determine the correct roads from what I have, because linestring with a single road-id may cover more than one real street with different name, reference and road type.I.e. the first 266339 is on a residential and primary road although id 266339 is the ID of the primary.

Could you also please provide some input data to reproduce the output? (The shorter the sample sequence the better.) Best in the json format to simply submit it to the matcher/tracker.

Attached

example.zip

Maybe this is a misconception of the output. Please note that the output consists of linestrings where each linestring represents the path TO the matched position on the road which means the END point of each linestring indicates the matched position. As an example, let's select some coordinates of the output and put them on the map

Does that mean that there is no way to detect which linestring is on which road? Because that's actually what I want to know: How much I traveled on which road class.

@stoecker
Copy link
Author

After looking at some travels through tunnels I now understand what you mean with the misconception of the output.

So that output is not really usable for my purpose (most of the time it nearly does what I want)? Is there any other way to get what I want?

  • input a number of measured points.
  • get the matched points and the corresponding road ID's for values like ref and street type.

ATM the only idea I have is to take the matched points and extract the roads from the database which match these points.

Or can I get that information via the Java interface?

@GeoWonk
Copy link

GeoWonk commented Dec 10, 2019

Hi

I am using a modified version of Barefoot's offline matching to return road ids and other information including the length travelled, the imputed speed experienced and some other things. The elementary start came from here #18 but there are some other caveats

  1. The id this will return will be an internal Barefoot id, not an osm_id, and this won't be stable when you import new data.
  2. You can change the class BaseRoad.java to create a method that returns the private variable refid which is the osm_id (at least in my modified code - I've forgotten what I've changed). You can also return road type. You'll also have to change Road.java so the method is available to MatcherKState.java.

My code isn't publishable as such yet, but if that isn't clear I can try to extract the relevant changes to demonstrate more clearly what is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants