Hi,
An exception is thrown while adding layers without name. (System.InvalidOperationException: 'A layer with the same Name already exists in the collection.')
i.e
var layer1 = new MapLayer();
var layer2 = new MapLayer();
map.Layers.Add(layer1);
map.Layers.Add(layer2);
The simple fix is to always pass a unique name, but it must work like say DataTable.Columns.Add(); (which internally generates unique name)
Thanks
Hi
We would like to use vector tiles in our offline mapping applications, like ones you can get here :- https://openmaptiles.com/downloads/dataset/osm/europe/great-britain/england/#5.03/52.946/-2.426
I think telerik only supports raster files right now. Is there any plans to support vector files in the future? Could it be added to the roadmap?
(I am not looking for a way to convert vector files into PNG/Bitmap/JPEG Image tiles in a custom provider thanks)
I have noticed in the routing there is no maxSolutions parameter available when querying the bing map api routing parameter.
https://docs.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-route
Hi Team,
Are there any intermediate zoomlevel in the RadMap object?
Currently the transition from one zoomlevel to another is too important.
Thank you for your response
I am wanting to load an image and polygon onto the Map control. I am using a KML file. I am able to load the polygon but NOT able to display the image in the map control.
i.e. if I open the KML file in google earth the image and polygon are displayed, I want to 'replicate' this in the Map control.
Below is my sample code and attached are the KML file and image files.
Dim osmProvider As New OpenStreetMapProvider()
Me.RadMap1.MapElement.Providers.Add(osmProvider)
Me.RadMap1.Layers.Clear()
Me.RadMap1.Layers.Add(New MapLayer("Pens"))
Using seatsStream As New FileStream("D:\MyTelerikMap\Farm.kml", FileMode.Open, FileAccess.Read)
Dim elements As List(Of MapVisualElement) = KmlReader.Read(seatsStream)
For Each item As MapVisualElement In elements
item.BorderWidth = 1
item.BorderColor = Color.Black
item.BackColor = Color.Red
Next
Me.RadMap1.Layers("Pens").AddRange(elements)
End Using
Dim MyCenter As PointG
MyCenter.Latitude = -16.545276685809551
MyCenter.Longitude = 28.87446081916244
RadMap1.MapElement.BringIntoView(MyCenter, 16)
Thank you in advanced for your assistance.
To reproduce: The TileSize property of the LocalMapProvider is readonly. Workaround: public class CustomLocalMapProvider : LocalMapProvider { public CustomLocalMapProvider() { FieldInfo fi = typeof(LocalMapProvider).GetField("tileSize", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(this, new Size(200,200)); } }
In WPF this is possible with custom provider: https://www.telerik.com/forums/map-control-and-web-map-service
How to reproduce: check the attached project, the expected behavior would be that the MapPoint object have its text painted Workaround: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); MapLayer pinsLayer = new MapLayer("Buildings Layout"); this.radMap1.Layers.Add(pinsLayer); EmptyMapProvider emptyProvider = new EmptyMapProvider(); emptyProvider.InitializationComplete += emptyProvider_InitializationComplete; this.radMap1.Providers.Add(emptyProvider); using (FileStream seatsStream = File.OpenRead(@"..\..\shapes-new\Label_Pk_Boulou2.shp")) { using (FileStream seatsDataStream = File.OpenRead(@"..\..\shapes-new\Label_Pk_Boulou2.dbf")) { ShapeFileReaderParameters parameters = new ShapeFileReaderParameters(); parameters.ShapeStream = seatsStream; parameters.DbfStream = seatsDataStream; //parameters.CoordinateConverter = new EPSG900913Converter(); ShapeFileReader reader = new ShapeFileReader(); List<MapVisualElement> elements = reader.Read(parameters); foreach (var item in elements) { item.Text = Convert.ToString(((IExtendedData)item).ExtendedData["Text"]); } this.radMap1.Layers["Buildings Layout"].AddRange(elements); } } } }
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)); } } }
https://msdn.microsoft.com/en-us/library/ff701717.aspx
A sample for the required functionality: public void AddMarker(RadMap Map) { SearchRequest r = new SearchRequest(); r.Query = "Paris, France"; r.UserData = new Guid(); bingProvider.SearchCompleted += BingProvider_SearchCompleted; bingProvider.SearchAsync(r); } private void BingProvider_SearchCompleted(object sender, SearchCompletedEventArgs e) { //one cannot access the UserData here }