motis-project / motis

Intermodal Mobility Information System

Home Page:https://motis-project.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

value of step_type has multiple types

ch33hau opened this issue · comments

Hi there,

I have a question regarding the JSON response.

According to the doc, step_type should be an enum in the string, but occasionally it returns a number.
Is this an expected behavior?

An example:

              {
                "step_type": 5,
                "street_name": "",
                "street_type": "NONE",
                "crossing_type": "GENERATED",
                "distance": 0.0,
                "duration": 0.0,
                "accessibility": 0.0,
                "path": {
                  "coordinates": [
                    52.534528,
                    13.196046
                  ]
                },
                "elevation_up": 0,
                "elevation_down": 0,
                "incline_up": false,
                "handrail": "UNKNOWN"
              },

In fact, the same also happens to edge_type:

              {
                "distance": 0.0,
                "duration": 0.0,
                "accessibility": 0.0,
                "path": {
                  "coordinates": [
                    52.567042,
                    13.411141,
                    52.567042,
                    13.411141
                  ]
                },
                "name": "",
                "osm_way_id": -4801304311,
                "edge_type": 5,
                "street_type": "NONE",
                "crossing_type": "GENERATED",
                "elevation_up": 0,
                "elevation_down": 0,
                "incline_up": true,
                "handrail": "UNKNOWN"
              },

I guess it's always an integer. Those are the values:

enum EdgeType : ubyte { CONNECTION, STREET, FOOTWAY, CROSSING, ELEVATOR }

enum RouteStepType : ubyte {
INVALID,
STREET,
FOOTWAY,
CROSSING,
ELEVATOR
}

They count up from zero.

We'll need to update the types in MOTIS and the docs. Some new step and edge types have recently been added to PPR.

They seems to be like strings for very long time. For example:

            "steps": [
              {
                "step_type": "FOOTWAY",
                "street_name": "",
                "street_type": "NONE",
                "crossing_type": "NONE",
                "distance": 0.023245,
                "duration": 0.016603,
                "accessibility": 0.0,
                "path": {
                  "coordinates": [
                    52.534668,
                    13.197191,
                    52.534668,
                    13.197191
                  ]
                },
                "elevation_up": 0,
                "elevation_down": 0,
                "incline_up": true,
                "handrail": "UNKNOWN"
              },

Also they are strings from the example in motis docs: https://motis-project.de/docs/api/endpoint/ppr.html

I guess it's always an integer. Those are the values:

enum EdgeType : ubyte { CONNECTION, STREET, FOOTWAY, CROSSING, ELEVATOR }

enum RouteStepType : ubyte {
INVALID,
STREET,
FOOTWAY,
CROSSING,
ELEVATOR
}

They count up from zero.

It is is zero-based, then what is step_type: 5 means?

We'll need to update the types in MOTIS and the docs. Some new step and edge types have recently been added to PPR.

So the valid one should be in Integer type? or will be fixed to only String type? or mixed types (the current behavior...)?

They should be strings. I forgot to add the new types to MOTIS, which is why they are currently returned as integers. I'll work on a fix that will add the new types - then they should be only strings again.

They should be strings. I forgot to add the new types to MOTIS, which is why they are currently returned as integers. I'll work on a fix that will add the new types - then they should be only strings again.

I see, thanks a lot @felixguendling @pablohoch for the quick responses!

The fix is merged and the docs are updated. We can publish a new release once the CI run is done.

The new edge and step types are for entrances (typically doors) and cycle barriers.

I've also updated PPR to the latest version. This new version also adds some preprocessing improvements regarding street crossings. Therefore, I would recommend deleting the ppr directory in your data directory before running the new MOTIS version. This will cause a re-import of the OSM file with the latest PPR version.

The fix is merged and the docs are updated. We can publish a new release once the CI run is done.

The new edge and step types are for entrances (typically doors) and cycle barriers.

I've also updated PPR to the latest version. This new version also adds some preprocessing improvements regarding street crossings. Therefore, I would recommend deleting the ppr directory in your data directory before running the new MOTIS version. This will cause a re-import of the OSM file with the latest PPR version.

Thanks for the instructions, will do =)