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

GetRouteRange not working when TravelMode is specified #31

Open
martinmedia-github opened this issue Dec 7, 2020 · 5 comments
Open

Comments

@martinmedia-github
Copy link

martinmedia-github commented Dec 7, 2020

Hi, I'm using 5.0.3 version.
I want to use the GetRouteRange by specifying the "TravelMode" parameter, which is took from an enum value (which is great!).
but I never managed to make it work. As soon I specify a travel mode, it return a 400 bad request: "One or more parameters were incorrectly specified or are mutually exclusive"

Example of my code:

RouteRangeRequest routeRangeRequest = new RouteRangeRequest()
{
        Query = "0....,0.....", //(whatever lat,lon : no space here)
        TimeBudgetInSec = "7200",
        TravelMode = TravelMode.Car, //using the provided enum
};

var routeRangeResponse = await _azureMapsService.GetRouteRange(routeRangeRequest).ConfigureAwait(continueOnCapturedContext: false);

I tried it in postman, direct with the Microsoft Endpoint
(https ://atlas.microsoft.com/route/range/json?api-version=1.0&TravelMode=car&timeBudgetInSec=7200...)
and it works when I put "car" (all lowercase), but if I put "Car" with a capital "C", I get the same kind of error.
I tried with a different travel mode with no luck, still the same issue.
Fortunately I must only use "car" travel mode for now and it is the default when it is not specified (according to Microsoft AzureMaps documentation).

So aside that it seems to pass the enum name in a case-sensitive way -- with the capital "C" for Car in my case, I don't know what else it could be.

Thank you for you help.

@perfahlen
Copy link
Owner

There is some work done in the dev branch. I will see if I can realease a new version within a week or so.

@anaratz
Copy link
Contributor

anaratz commented May 24, 2021

I also seem to get this same issue in 6.0.0.0 when the TravelMode param is supplied.
image
Is there a fix still pending, or am I missing something.

Thanks

@RedBlack
Copy link

RedBlack commented Sep 7, 2021

We are having the same issue using 6.0.0.0 but on the GetRouteDirections call. We cannot upgrade to 7.1 as we are not able to use .Net5 yet. We have just left the TravelMode blank so it defaults to "car" in Azure and returns us results without erroring. However this is only a temporary fix as our clients are likely to want to specify the TravelMode.

@anaratz
Copy link
Contributor

anaratz commented Sep 7, 2021

Hi RedBlack,

The issue is just case-sensitivity in the TravelMode.cs class

As a workaround you could:

  • Download the 6.0.0.0 code as a Zip file
  • Change the TravelModes to be lower case
  • Increment the project version to 6.0.0.1
  • Rebuild the solution to generate an AzureMapsRestToolkit.6.0.1.nupkg in the bin folder
  • Reference the Nuget Package from a local source or host your own package on MyGet or something
    (Then you could use all the Travel Modes)

@RedBlack
Copy link

RedBlack commented Sep 7, 2021

Hi

Thanks for the workaround. It is working, it just means we have to maintain our own version of this for now.

FYI - These where the enums that I had to change: RouteType, TravelMode, VehicleEngineType

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

4 participants