Closed qqnluaq closed 3 years ago
Great enhancement suggestion Ben, thanks. Just a couple of comments:
Distance can be in metric (e.g. both km and m) or imperial(e.g., both miles and feet) as specified in the distanceUnit query parameter so I would add a distanceUnit property (e.g., km, m, mi, ft) to each direction object.
Time can also be in hours, minutes or seconds so we might want a timeUnit as well.
I think the intent is whatever code is making use of the time and distance values probably wants to format them (or process them) on it's own so really just one distance unit, meters or feet, based on the query params, and just seconds, always. The type parameter was added to support styling the directions with appropriate icons, right now the app only supports ferry and event icons. When I added it, I kinda expected this request to come along, eventually.
Agreed. As for icons, I can see an app developer using their own turn icons (e.g., left, right, straight).
I have implemented this locally with the following changes:
{
"type":"START",
"name":"Latoria Rd",
"distance":"1.798",
"time":129,
"heading":"EAST",
"text":"Head east on Latoria Rd for 1.8 km (2 minutes 9 seconds)",
"point":[-123.52989,48.41535]
},
{
"type":"TURN_RIGHT",
"name":"Arbutus Rd",
"distance":0.511,
"time":70,
"text":"Turn right onto Arbutus Rd for 500 m (1 minute 10 seconds)",
"point":[-123.30314,48.47072]
},
Verified in dev
The entries in the
directions
list in a typical result of a 'directions' request look like:The
text
contains at least 4 separate pieces of information:Only one of these is provided as a separate property (
type
). The other pieces of infomation are formatted intext
and hence are made more difficult than it needs to be to format this information in an application-specific way.Describe the solution you'd like
I want to see the other parts of the
text
broken out into their own properties: