microsoft / BingMapsRESTToolkit

This is a portable class library which makes it easy to access the Bing Maps REST services from .NET.

Home Page:https://github.com/Microsoft/BingMapsRESTToolkit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bing Maps Key not recognized in Elevation

SezMe opened this issue · comments

commented

My Bing Maps key does not work for elevation requests but does work for other types of requests. It appears that somehow valid keys do not work for elevation requests.

Hi SezMe,
Can you please provide a set of steps someone else could take to see this issue? Is it as simple as:

  1. Create a project with this rest toolkit
  2. Try to make an elevation call like

Dim Request As ElevationRequest = New ElevationRequest With
{
.BingMapsKey = "Qs....zF",
.Height = ElevationType.Ellipsoid,
.Points = pts
}
Dim Reply As Response = Await ServiceManager.GetResponseAsync(Request)
Debug.WriteLine(Reply.AuthenticationResultCode)
Debug.WriteLine(Reply.StatusCode)
Actual Result:
Reply.AuthenticationResultCode=NoCredentials
Reply.StatusCode=401

Expected Result:
the same as https://docs.microsoft.com/en-us/bingmaps/rest-services/elevations/get-elevations

commented

Yes, pretty much. See the attached
PIM.zip

@SezMe , Thanks for your feedback. I looked into this issue, it is a bug in the way we consume the "Height" parameter. For now, a temp walk around would be leaving the Height as its default option.

Just change your code from:
Dim Request As ElevationRequest = New ElevationRequest With
{
.BingMapsKey = "someKey",
.Height = ElevationType.Ellipsoid,
.Points = coords
}
to:
Dim Request As ElevationRequest = New ElevationRequest With
{
.BingMapsKey = "someKey",
.Points = coords
}

I will work on a fix for this and will update this thread once the fix is ready.

@jiangmouren Do you have an update?

Sorry for not updating the thread.
The fix has already been merged 06/25/2020. #48
@IoTGirl you can go ahead and close the ticket.

Thanks!