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

Can't Display Truck Route Directions #23

Open
ken92 opened this issue Oct 16, 2018 · 4 comments
Open

Can't Display Truck Route Directions #23

ken92 opened this issue Oct 16, 2018 · 4 comments

Comments

@ken92
Copy link

ken92 commented Oct 16, 2018

I've been messing with the Bing Maps API with Postman and comparing what react-bingmaps is sending and it appears that for whatever reason, when routeMode is set to truck, Bing Maps will return an error if isViaPoint is set to null. I've tried to set it to true, 1, 0, "1", "0", "true", "false"`, but any falsy value is being automatically set to null in the code.

An easy fix would be to replace this:

var isViaPoint = wayPoints[wayPointsIndex].isViaPoint ? wayPoints[wayPointsIndex].isViaPoint : null;

with this:

var isViaPoint = wayPoints[wayPointsIndex].isViaPoint !== undefined ? wayPoints[wayPointsIndex].isViaPoint : null;

That way, users can pass falsy values and it will be passed on to the Bing Maps API as they intend.

Alternatively, if anyone knows how to get this to work without modifying the repo, I'm all ears.

@ken92
Copy link
Author

ken92 commented Oct 16, 2018

I tested this in my own code and it solves my use case's problem. I can now view truck routes in my map! :)

@ken92
Copy link
Author

ken92 commented Oct 23, 2018

@iniamudhan Any chance I can get an approval on this? My code needs to go into QA soon and I don't really want to make my own spin-off of your repo just for this one line fix.

@ken92
Copy link
Author

ken92 commented Oct 23, 2018

My code needs to go into QA today, it turns out. In the meantime, I've created this package with this fix in it. Currently, there are no other differences.

https://www.npmjs.com/package/@possumsnorts/react-bingmaps

@dillonbartkus
Copy link

How are you able to get truck routes to show? I can do driving and transit, but when I change routeMode to truck I get an error:

"errorDetails": [
"One or more parameters are not valid.",
"waypoint: Parameter is missing"
]

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

2 participants