none
Bing Maps API issue within Microsoft PowerApps

    Question

  • Dear all,

    I am currently trying to add a Mileage Tracking function to a Microsoft PowerApps app we use in our organization.
    Therefore I am using the Bing Maps connector, currently in Preview.

    I have signed up to the Bing Maps Dev Center using my Microsoft-account and created a new API key.
    I have verified with the Bing Maps Helpdesk to verify that I followed the correct procedure.

    Next, I have added the key to the PowerApps Connections menu. There is no mistake possible in this process, there is only 1 field and 1 way to enter it.

    A little bit more info about I have setup the PowerApps app:
    I have added two TextInput controls to the screen TextInput1 and TextInput2. 
    TextInput1.Default = Location.Latitude (The Location.Latitude is the function which retrieves the current latitude value as soon as the GPS has been intialized)
    TextInput2.Default = Location.Longitude (Logically, does the same, but then retrieves the longtitude)

    At last I have added a Label (Label1) to the screen, which converts the coordinates to a formatted address. This is where the Bing Maps API connection comes in.

    This is how:
    Label1.Text = BingMaps.GetLocationByPoint(TextInput1.Text,TextInput2.Text).address.formattedAddress

    This means: the "Text" property of the Label control has been configured to get the location by point based on the Latitude (TextInput1) and Longtitude (TextInput2). Then, the .address.formattedAddress function makes sure that a normal interpretable address is shown.

    For me, this works perfectly fine! For my colleagues, somehow it does not! Somehow it does not convert the coordinates to a formatted address, and it just shows the Latitude and Longtitude coordinates divided by a comma. I've included both screenshots below:

    Please look at the text below "Uw huidige locatie is:", which means "Your current location is:"

    Good (my device):

    Please find the picture on the PowerApps Community link below, since I could not manage to upload a picture here. It keeps saying: "Body text cannot contain images or links until we are able to verify your account."

    Bad (my colleagues):

    Please find the picture on the PowerApps Community link below, since I could not manage to upload a picture here. It keeps saying: "Body text cannot contain images or links until we are able to verify your account."

    One colleague told me that he was getting some kind of an error concerning the API. But I could not get a hold of that within the PowerApps app yet.

    I have tried to reach out to Office 365 PowerApps Support, but they told me that they couldn't help me out with that and that I could better try here on the PowerApps community. I have tried my luck out there as well:
    https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Bing-Maps-API-issue/m-p/164880#M2500

    So far, no luck.

    Yesterday, one of the PowerApps Customer Success Team engineers suggested me to post my issue here.

    I hope that this is the right Forum category, and that someone can help me out. Because it would be great if we could achieve this only with Microsoft technology.

    Thanks for any help!

    Joost

    Saturday, October 20, 2018 6:55 PM

All replies

  • Hi Joost,

    This call looks like nothing I have ever seen before and I am surprised it works as I would expect it to fail.

    Label1.Text = BingMaps.GetLocationByPoint(TextInput1.Text,TextInput2.Text).address.formattedAddress

    The Community for Power App is at https://powerusers.microsoft.com/t5/PowerApps-Community/ct-p/PowerApps1

    Hopefully they understand the call you are making.  I have never seen a case where a procedure call takes variables mid call like your sample above.  Maybe try the steps as given here: https://powerapps.microsoft.com/en-us/blog/image-control-static-maps-api/ as these calls look more like the expected Bing Map calls.

    For Bing Maps Use:

    "https://dev.virtualearth.net/REST/V1/Imagery/Map/Road/" & EncodeUrl(txtLocation.Text) & "?mapSize=" & txtImageWidth & "," & txtImageHeight & "&key="&txtBingMapsKey.Text

    Bing Maps: Refer to the Get a Static Map article for examples and other parameters.

    Sincerely,

    IoTGirl


    Monday, October 22, 2018 7:41 PM
    Owner
  • Hi Joost,

    This call looks like nothing I have ever seen before and I am surprised it works as I would expect it to fail.

    Label1.Text = BingMaps.GetLocationByPoint(TextInput1.Text,TextInput2.Text).address.formattedAddress

    The Community for Power App is at https://powerusers.microsoft.com/t5/PowerApps-Community/ct-p/PowerApps1

    Hopefully they understand the call you are making.  I have never seen a case where a procedure call takes variables mid call like your sample above.  Maybe try the steps as given here: https://powerapps.microsoft.com/en-us/blog/image-control-static-maps-api/ as these calls look more like the expected Bing Map calls.

    For Bing Maps Use:

    "https://dev.virtualearth.net/REST/V1/Imagery/Map/Road/" & EncodeUrl(txtLocation.Text) & "?mapSize=" & txtImageWidth & "," & txtImageHeight & "&key="&txtBingMapsKey.Text

    Bing Maps: Refer to the Get a Static Map article for examples and other parameters.

    Sincerely,

    IoTGirl


    Hi IoTGirl,

    First of all my apologies for the late reply, I forgot to configure the Alert Me.

    What I find interesting, is that somehow all works fine on my work notebook. I have a private notebook as well, and when I launch the PowerApps app from the browser on that device, it is no longer working, even though it is asking to allow the use of my location. Everything I do is exactly the same: OS, internet browser, user account (authentication), app.

    I am pretty sure now, that somehow the API ties the API key to my work notebook. No matter which Office 365 account I use on my notebook, all will work, but when I switch device it no longer works. Would that make sense?

    Do you have any idea what might prevent other devices from using the API features? Does it register a cookie, a MAC-address? Something that might register my work notebook with the API key?

    Kind regards,

    Joost

    Friday, October 26, 2018 10:59 PM
  • Hi Joost,

    I can confirm that the Bing Maps key does not care what PC uses it so I suspect this is a Power Apps issue rather than a Maps issue.

    You can try using the interactive SDK at https://www.bing.com/api/maps/sdk/mapcontrol/isdk and try a few items from the left menu to confirm.

    Sincerely,

    IoTGirl

    Saturday, October 27, 2018 5:27 PM
    Owner