Completed
Last Updated: 21 Dec 2017 07:49 by ADMIN
ADMIN
Hristo
Created on: 13 Nov 2017 13:38
Category: Map
Type: Feature Request
1
ADD. RadMap - an additional imagery metadata in the BingRestMapProvider for an ImagerySet.RoadOnDemand tile service
Until released use the following custom implementation:
public partial class RoadOnDemandForm : RadForm
{
    public RoadOnDemandForm()
    {
        InitializeComponent();

        string cacheFolder = @"..\..\cache";
        BingRestMapProvider bingProvider = new MyBingRestMapProvider();
        bingProvider.Culture = System.Threading.Thread.CurrentThread.CurrentCulture;
        bingProvider.ImagerySet = ImagerySet.Road;
        bingProvider.UseSession = true;
        bingProvider.BingKey = "YourApiKey";

        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));
        }
    }
}
0 comments