cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lbudack
Level: Powered On

Bing Static Map not Rendering

Hello! 

 

Walking through creating my first app so I followed this guide: https://powerapps.microsoft.com/en-us/blog/image-control-static-maps-api/

 

However, the map is not loading with the image control set to: 

"https://dev.virtualearth.net/REST/V1/Imagery/Map/"&drpBingImagerySets.Selected.Value&"/" & EncodeUrl(txtLocation.Text) & "/"& slZoom.Value &"?mapSize=" & txtImageWidth & "," & txtImageHeight & "&pp=" & ";21;I+am+here&key="&txtBingMapsKey.Text

 

Capture.JPG

I think it has something to do with the API. I've set referrer security on the key to the following: 

"https://www.bingmapsportal.com/" and "*powerapps.com". I'm new to the whole API thing so that's why I think there's something amiss with my settings here. How do I determine the URL of the site attempting to call the static map? 

 

Capture2.JPG

Thanks for any and all assistance! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Bing Static Map not Rendering

Hi @lbudack ,

It is an known issue with the Bing Maps Static API. Currently, within PowerApps, we could not get a static map based on Location Address using Bing Maps Static API. Instead, we need to provide a specific Latitude value and Longitude value of a location Address to get a static map.

 

As an alternative solution, you could consider get the corresponding Latitude value and Longitude value of your specific location address using Bing Maps connector. And then use the retrieved Latitude value and Longitude value within the Bing Maps Static API URL Link.

 

I have made a test on my side, please consider take a try with the following workaround:11.JPG

Set the Image property of the Image control to following:

"https://dev.virtualearth.net/REST/V1/Imagery/Map/"&drpBingImagerySets.SelectedText.Value&"/" & 
If(
tglGPSLocation.Value,
EncodeUrl(txtLocation.Text),
EncodeUrl(BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.latitude & "," & BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.longitude)
) & "/"& slZoom.Value &"?mapSize=" & txtImageWidth & "," & txtImageHeight & "&pp=" &
If(
tglGPSLocation.Value,
txtLocation.Text,
BingMaps.GetLocationByAddress({addressLine: txtLocation.Text }).point.coordinates.latitude & "," & BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.longitude
) & ";21;I+am+here&key="&txtBingMapsKey.Text

More details about the Bing Maps connector, please check the following article:

Bing Maps connector

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
myke_deabreu
Level 8

Re: Bing Static Map not Rendering

This is mycode that works well on a vehicle inspection app we use:

 

First I set the users location to varibles as I found using the dynamic Latitude and Logitude the image flickered like crazy.

Set(
myLocation,
BingMaps.GetLocationByPoint(
Location.Latitude,
Location.Longitude))

 

You could have your search bar do something similar using the "OnChange" and use the BingMaps.GetLocationByAddress({addressLine:TextInput1.Text})

 

Then I set my Image formula as follows:

"http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" & myLocation.point.coordinates.latitude & "," & myLocation.point.coordinates.longitude & "/14?mapSize=1000,400&pp=" & myLocation.point.coordinates.latitude & "," & myLocation.point.coordinates.longitude & ";36;" & "
&key=<API KEY HERE>"

 

Give it a try and let me know if this works for you.

Highlighted
Community Support Team
Community Support Team

Re: Bing Static Map not Rendering

Hi @lbudack ,

It is an known issue with the Bing Maps Static API. Currently, within PowerApps, we could not get a static map based on Location Address using Bing Maps Static API. Instead, we need to provide a specific Latitude value and Longitude value of a location Address to get a static map.

 

As an alternative solution, you could consider get the corresponding Latitude value and Longitude value of your specific location address using Bing Maps connector. And then use the retrieved Latitude value and Longitude value within the Bing Maps Static API URL Link.

 

I have made a test on my side, please consider take a try with the following workaround:11.JPG

Set the Image property of the Image control to following:

"https://dev.virtualearth.net/REST/V1/Imagery/Map/"&drpBingImagerySets.SelectedText.Value&"/" & 
If(
tglGPSLocation.Value,
EncodeUrl(txtLocation.Text),
EncodeUrl(BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.latitude & "," & BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.longitude)
) & "/"& slZoom.Value &"?mapSize=" & txtImageWidth & "," & txtImageHeight & "&pp=" &
If(
tglGPSLocation.Value,
txtLocation.Text,
BingMaps.GetLocationByAddress({addressLine: txtLocation.Text }).point.coordinates.latitude & "," & BingMaps.GetLocationByAddress({addressLine: txtLocation.Text}).point.coordinates.longitude
) & ";21;I+am+here&key="&txtBingMapsKey.Text

More details about the Bing Maps connector, please check the following article:

Bing Maps connector

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbudack
Level: Powered On

Re: Bing Static Map not Rendering

Thanks, Kris Dai @v-xida-msft! I had forgotten to set up the connector properly, but once I did that, your solution worked like a charm! 

 

@myke_deabreu - Thanks for your response too! That will be helpful to me going forward as I am now going to work on a more custom solution now that I understand how the mapping features function. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 48 members 4,301 guests
Please welcome our newest community members: