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

Scalebar is missing

vibalani opened this issue · comments

Hi,

I am using Bing maps to generate a static image and I am not able to find property to enable scalebar. Is it available if I use Bing maps to get the request and stream using Service Manager. Please find the details below:

Workflow:

  1. Get request using BingMapsRESTToolkit.ImageryRequest

image

  1. Use the request from #1 and call service manager to return stream
    image

  2. Get background map image out of stream
    image

  3. Below is the sample output which is missing scale bar.

image

Please let me know if I am not using the correct settings or function call or is it not supported yet. Thank you in advance!!

The Bing Maps static image service doesn't have an option to add a scalebar, thus this service wrapper doesn't expose such a feature. (Docs: https://docs.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map)

That said, if you know the zoom level and center coordinate of the map image, a scale could be calculated and a scalebar added using a drawing library. If you want to explore this route, here is an old blog I wrote that does something similar via WPF: https://rbrundritt.wordpress.com/2014/10/09/multiple-measurement-scale-bar-in-wpf/ The drawing/UX part would be different, but the math would be the same.

rbrundritt - thank you so much for your reply and help!!

@rbrundritt - Hi...firstly, thanks for the logic. I really appreciate it.
I have a silly question, the maxScaleBarWidth is set to 100 but visually on static image it looks small and when I tried to increase the width to 150 or 200 the bar width calculation (Width = scaleValue / Resolution) I am still getting same if it were 100. Is there anything else I should be doing to get a bigger scale bar in width. The values are getting calculated correctly it's just the size of the bar itself I am having issues.

Font: Arial 10 px
Again, thanks a lot for your help and time!!

image

Not sure on that one. It would depend on how you are creating the scale bars. If doing this in XAML, it's possible there is some "best fit" scaling happening of the control.