This is a migrated thread and some comments may be shown as answers.

RadMap with ImagerySet

7 Answers 113 Views
Map
This is a migrated thread and some comments may be shown as answers.
Snehal
Top achievements
Rank 1
Snehal asked on 10 Nov 2017, 03:46 PM

Hi,

We are having issues with older road imagery from Bing Maps API. Some roads are not getting displayed on the map.

We are using Telerik.Windows.Controls.RadMap . We have received information that we need to request the imagery from BingREST imagery and we should  be using the "RoadOnDemand" Imagery Set as per the documentation here: https://msdn.microsoft.com/en-us/library/ff701716.aspx.

Can you help us to understand how to set property ImagerySet to 'RoadOnDemand' for Telerik.Windows.Controls.RadMap that we are using?

 

Thanks,

7 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 13 Nov 2017, 01:53 PM
Hello Snehal,

Thank you for writing.

Currently, the RoadOnDemand imagery set is not directly available in the RadMap control. That is why I have logged a feature request on our feedback portal here: ADD. RadMap - an additional imagery metadata in the BingRestMapProvider for an ImagerySet.RoadOnDemand tile service. I have also updated your Telerik points for the report. Additionally, you can subscribe to the item and be updated with all of its status changes.

Until we release the new feature you can create a custom BingRestMapProvider and override the InitializeImageryService method. There you could specify the RoadOnDemand imagery set while building the URI: 
public partial class RoadOnDemandForm : RadForm
{
    public RoadOnDemandForm()
    {
        InitializeComponent();
 
        string cacheFolder = @"..\..\cache";
        BingRestMapProvider bingProvider = new MyBingRestMapProvider();
        bingProvider.Culture = System.Threading.Thread.CurrentThread.CurrentCulture;
        bingProvider.UseSession = true;
        bingProvider.BingKey = "YouBingKey";
 
        LocalFileCacheProvider cache = new LocalFileCacheProvider(cacheFolder);
        bingProvider.CacheProvider = cache;
 
        this.radMap1.MapElement.Providers.Add(bingProvider);
    }
}
 
public class MyBingRestMapProvider : BingRestMapProvider
{
    private const string ImageryMetadataServiceUri = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/{set}?output=json&key={key}&c={culture}&dir={directory}";
 
    protected override void InitializeImageryService()
    {
        typeof(BingRestMapProvider).GetField("tileMetadataInfo", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(this, null);
 
        try
        {
            string uriString = ImageryMetadataServiceUri;
            uriString = uriString.Replace("{set}", "RoadOnDemand");
            uriString = uriString.Replace("{key}", string.IsNullOrEmpty(this.SessionId) ? this.BingKey : this.SessionId);
            uriString = uriString.Replace("{culture}", this.Culture.ToString());
            uriString = uriString.Replace("{directory}", "0");
 
            WebClient client = new WebClient();
            client.DownloadStringCompleted += this.InitializeImageryMetadataCompleted;
            client.DownloadStringAsync(new Uri(uriString, UriKind.Absolute));
        }
        catch (Exception ex)
        {
            throw new Exception(string.Format("Imagery Service Exception: {0}", ex.Message));
        }
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Snehal
Top achievements
Rank 1
answered on 14 Dec 2017, 09:35 AM
Thanks for sharing this solution.

However, I am receiving below error message while implementing this,for the method InitializeImageryService()
'No suitable method found to override'
I checked the metadata of BingRestMapProvider , it does not list this method.
Can you Please help.

Thanks,

Snehal

0
Hristo
Telerik team
answered on 15 Dec 2017, 08:55 AM
Hello Snehal,

The method is virtual and located in the BingRestMapProvider class. It has been part of the provider ever since the control got released: https://www.telerik.com/support/whats-new/winforms/release-history/ui-for-winforms-r3-2016-(version-2016.3.913). Please note that this forum discusses the RadMap control for WinForms: https://docs.telerik.com/devtools/winforms/map/overview.

I hope this helps. Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Snehal
Top achievements
Rank 1
answered on 18 Dec 2017, 10:14 AM

Hi,

PFA screenshot. Please suggest.

Thanks,

Snehal Jangam

 

 

0
Hristo
Telerik team
answered on 18 Dec 2017, 11:18 AM
Hello Snehal,

Thank you for writing back.

As I said previously the InitializeImageryService method is declared virtual and it has been part of the BingRestMapProvider class ever since day one. The only reason which I can think of, not allowing you to override it, is that if you have by mistake generated the BingRestMapProvider class in your project leaving it empty. This class is part of the Telerik.WinControls.RadMap.dll assembly and in order to use it, you should add the following namespace to your form: Telerik.WinControls.UI.

I am also attaching my test project. I would like to also point that the item has already been implemented in our codebase. The new imagery set will be publicly available with our R1 2018 release scheduled for the middle of January.

I hope this helps. Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Snehal
Top achievements
Rank 1
answered on 19 Dec 2017, 09:04 AM
 
Hi,
 
Thanks for sharing the code and information.

We have used Telerik.Windows.Controls.RadMap and Telerik.Windows.Controls.Map.BingRestMapProvider in our projects.

Hence it was not able to find the InitializeImageryService method.

Can you please suggest solution with Telerik.Windows.Controls.Map.BingRestMapProvider .

Regards,

Snehal

0
Hristo
Telerik team
answered on 19 Dec 2017, 01:34 PM
Hello Snehal,

Thank you for writing back.

As I understand you are using the WPF version of the control. It appears that its BingRestMapProvider implementation does not expose a virtual initialization method of the imagery service. Since this thread is discussing the WinForms version of the control, please post your question in the WPF forums or submit a ticket specifying WPF as the product you are using.

Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Map
Asked by
Snehal
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Snehal
Top achievements
Rank 1
Share this question
or