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

Serialize ref field #67

Closed
1ec5 opened this issue Sep 7, 2016 · 8 comments · Fixed by #91
Closed

Serialize ref field #67

1ec5 opened this issue Sep 7, 2016 · 8 comments · Fixed by #91
Assignees

Comments

@1ec5
Copy link
Contributor

1ec5 commented Sep 7, 2016

Once Project-OSRM/osrm-backend#2857 makes it into production and the Directions API exposes a separate ref field for each step, we'll need to add a route reference property to each RouteStep, similar to the one for destinations. Assuming that v4 doesn't add this separate field, we'll fall back to a regular expression that parses the ref out of the way name.

Better yet, we could implement a Road struct that bundles a road's name with its route designation. Eventually that struct could grow to include other information about the road, such as its classification.

/cc @bsudekum

@aataraxiaa
Copy link
Contributor

Road struct that bundles the name & designation gets my vote 😄

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 8, 2016

The struct will need to be implemented in Objective-C, so it'll bridge to Swift. If we implement it in Swift, it won't bridge to Objective-C.

@1ec5 1ec5 mentioned this issue Oct 5, 2016
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 7, 2016

Here are two options for the implementation:

  • Add a roadDesignation property to RouteStep.
  • Replace the name property with a road property of type Road. Road has two fields, name and designation. Road is either a Swift class with String-typed fields or a C struct with char *-typed fields, but not a Swift struct.

We should avoid the term “ref”, because that’s OpenStreetMap jargon (really just an OSM tag name). A better term is “road designation”.

Based on #77 (comment), we’ll also need to trim the parenthesized designation from the name property in the response object, because apparently the Directions API is including that information redundantly in both ref and name.

@bsudekum
Copy link

Add a roadDesignation property to RouteStep.

I'm for this. This allows the developer to decide if and when to use a ref vs a name.

@1ec5
Copy link
Contributor Author

1ec5 commented Oct 12, 2016

Both options let the developer decide if and when to use a ref versus a name. With the Road class, you’d say road.ref or road.name. If we do go with just a roadDesignation property, we should redundantly implement the road property too, using a Road struct, for the benefit of Swift developers.

@1ec5
Copy link
Contributor Author

1ec5 commented Oct 17, 2016

To avoid a proliferation of properties on RouteStep, we’re definitely going to need a Road class or struct. Road will be useful for #78 as well as the rotary_name and rotary_pronunciation fields, which we would simply serialize as a rotary property of type Road.

@simplyira
Copy link

simplyira commented Feb 10, 2017

Hey! I came across this discussion, because "road designation" sounds like the exact property I need. Looking throught the source code, this now seems to be "code" and it isn't what I imagined. How could I acess road types pls? "Cycling path" "residential" etc. I can see them mentioned in other projects :) Can't find documentation yet. Any way to access it? The obvious .type on step is not working. Thanks

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 10, 2017

“Road designation” (now code) refers to route numbers like “I-80”, “M 5”, etc. type refers to the maneuver type, not the road type. Unfortunately, OSRM’s architecture doesn’t allow for additional metadata about the road to be preserved in the routing graph, although we’re working on a solution for reassociating OSM way data with the returned way. Stay tuned.

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

Successfully merging a pull request may close this issue.

4 participants