Hello,
I am building a demo for a travel agent company using the RadMap demo. I could be wrong that I think that RadMap only show the detail (street level) map for US. But Bing provide the detail map for a lot of countries other than US (like Japan, China, France, etc).
I searched online and looks like by default Bing will provide the detail map for US. But if you want to see the detail map other than US, you have to load it specially.
I found some sample code used together with Microsoft Bing Map Control.
Does RadMap provide same capability? Can someone show me some sample?
Much appreciated,
David
I am building a demo for a travel agent company using the RadMap demo. I could be wrong that I think that RadMap only show the detail (street level) map for US. But Bing provide the detail map for a lot of countries other than US (like Japan, China, France, etc).
I searched online and looks like by default Bing will provide the detail map for US. But if you want to see the detail map other than US, you have to load it specially.
I found some sample code used together with Microsoft Bing Map Control.
Does RadMap provide same capability? Can someone show me some sample?
Much appreciated,
David
UriBuilder tileSourceUri = new UriBuilder("http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41");
MapTileLayer tileLayer = new MapTileLayer();
LocationRectTileSource tileSource =
new LocationRectTileSource(
tileSourceUri.Uri.ToString(),
new LocationRect(new Location(60, 60), new Location(13, 140)),
new Range<double>(1, 16));
tileLayer.TileSources.Add(tileSource);
tileLayer.Opacity = 0.9;
myMap.Children.Add(tileLayer);
MapTileLayer tileLayer = new MapTileLayer();
LocationRectTileSource tileSource =
new LocationRectTileSource(
tileSourceUri.Uri.ToString(),
new LocationRect(new Location(60, 60), new Location(13, 140)),
new Range<double>(1, 16));
tileLayer.TileSources.Add(tileSource);
tileLayer.Opacity = 0.9;
myMap.Children.Add(tileLayer);
5 Answers, 1 is accepted
0
David
Top achievements
Rank 1
answered on 23 Jan 2011, 07:08 AM
Did more search about the Bing Maps Geographic Coverage.
Based on the link below.
http://msdn.microsoft.com/en-us/library/dd435699(v=MSDN.10).aspx
China only have the major road map data supported by Bing (by default).
However, if you go to http://cn.bing.com/ditu/ which will show you the full street data of China location.
But according to: Richard_Brundritt, Bing Map MVP.
"but you could pull in the chinesse map tiles from the Chinesse AJAX map as a new tile layer."
Looks like there is a way. Any help will be highly appreicated.
Thx,
David
Based on the link below.
http://msdn.microsoft.com/en-us/library/dd435699(v=MSDN.10).aspx
China only have the major road map data supported by Bing (by default).
However, if you go to http://cn.bing.com/ditu/ which will show you the full street data of China location.
But according to: Richard_Brundritt, Bing Map MVP.
"but you could pull in the chinesse map tiles from the Chinesse AJAX map as a new tile layer."
Looks like there is a way. Any help will be highly appreicated.
Thx,
David
0
Hi David,
The current version of the RadMap control doesn't support multiple layered tile providers. We are planning to implement this feature in the future releases of our control. You can check its availablility using our PITS:
http://www.telerik.com/support/pits.aspx#/public/silverlight/31
Fortunately you can create a custom map provider which will show tiles from a specific source. I have attached the solution with custom provider for Open Street Maps. You can use this code as a base for your custom provider which will use China specific URL.
All the best,
Andrey Murzov
the Telerik team
The current version of the RadMap control doesn't support multiple layered tile providers. We are planning to implement this feature in the future releases of our control. You can check its availablility using our PITS:
http://www.telerik.com/support/pits.aspx#/public/silverlight/31
Fortunately you can create a custom map provider which will show tiles from a specific source. I have attached the solution with custom provider for Open Street Maps. You can use this code as a base for your custom provider which will use China specific URL.
All the best,
Andrey Murzov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
0
David
Top achievements
Rank 1
answered on 27 Jan 2011, 06:16 AM
One more issue exposed:
Not only the toolbar is missing but also the MapPoint/HotSpot Pin is misplaced in the upper left of the map. (It supposed to be in the center of the map) The tile I get back is correct though. Below is my tile custom provider. I also attached the screenshot
Not only the toolbar is missing but also the MapPoint/HotSpot Pin is misplaced in the upper left of the map. (It supposed to be in the center of the map) The tile I get back is correct though. Below is my tile custom provider. I also attached the screenshot
public class OpenStreetCustomProvider : BingMapSource
{
private const string TileMapnikUrlFormat = @"http://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
TileLayer tileLayer;
private bool initialized;
/// <
summary
>
/// Initializes a new instance of the CustomOpenStreetMapProvider class.
/// </
summary
>
/// <
param
name
=
"mode"
>Map mode.</
param
>
/// <
param
name
=
"labelVisible"
>Is labels visible.</
param
>
public OpenStreetCustomProvider(MapMode mode, bool labelVisible)
: base(mode, labelVisible, BingMapHelper.VEKey)
{
}
/// <
summary
>
/// Initializes a new instance of the CustomOpenStreetMapProvider class.
/// </
summary
>
public OpenStreetCustomProvider()
: this(MapMode.Road, true)
{
}
/// <
summary
>
/// Gets value which indicates whether labels are supported by the map provider.
/// </
summary
>
public override bool IsLabelSupported
{
get
{
return false;
}
}
/// <
summary
>
/// Returns the SpatialReference for the map provider.
/// </
summary
>
public override ISpatialReference SpatialReference
{
get
{
return new MercatorProjection();
}
}
/// <
summary
>
/// Gets list of the supported map modes.
/// </
summary
>
/// <
returns
>List of the supported map modes.</
returns
>
public override IEnumerable<
MapMode
> SupportedModes
{
get
{
yield return MapMode.Road;
}
}
/// <
summary
>
/// Gets the image URI.
/// </
summary
>
/// <
param
name
=
"tileLevel"
>Tile level.</
param
>
/// <
param
name
=
"tilePositionX"
>Tile X.</
param
>
/// <
param
name
=
"tilePositionY"
>Tile Y.</
param
>
/// <
returns
>URI of image.</
returns
>
public override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
{
int zoomLevel = ConvertTileToZoomLevel(tileLevel);
string QuadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoomLevel);
//string url = TileMapnikUrlFormat;
string url = "http://r1.tiles.ditu.live.com/tiles/r{quad}.png?g=66";
url = ProtocolHelper.SetScheme(url);
url = url.Replace("{quad}", QuadKey);
//url = url.Replace("{zoom}", zoomLevel.ToString(CultureInfo.InvariantCulture));
//url = url.Replace("{x}", tilePositionX.ToString(CultureInfo.InvariantCulture));
//url = url.Replace("{y}", tilePositionY.ToString(CultureInfo.InvariantCulture));
return new Uri(url);
}
/// <
summary
>
/// Initialize provider.
/// </
summary
>
public override void Initialize()
{
this.initialized = base.IsInitialized;
}
/// <
summary
>
/// Gets value which indicates whether given mode is supported by map provider.
/// </
summary
>
/// <
param
name
=
"mode"
>Map mode to check.</
param
>
/// <
returns
>true if given mode is supported. Otherwise - false.</
returns
>
public override bool IsModeSupported(MapMode mode)
{
return true;
}
/// <
summary
>
/// MapModeChanged handler.
/// </
summary
>
protected override void OnMapModeChanged(MapMode oldMode, MapMode newMode)
{
}
}
0
Accepted
Hi David,
The BingMapSource class is designed for internal purposes only. You shouldn't use it as a base class for a custom provider. The absent map toolbar and the MapPoint misplacing are results of this inheritance.
The custom provider should inherit from the MapProviderBase class only. Of course in this case you will need for the TileXYToQuadKey method.
The source code of this method is below.
All the best,
Andrey Murzov
the Telerik team
The BingMapSource class is designed for internal purposes only. You shouldn't use it as a base class for a custom provider. The absent map toolbar and the MapPoint misplacing are results of this inheritance.
The custom provider should inherit from the MapProviderBase class only. Of course in this case you will need for the TileXYToQuadKey method.
The source code of this method is below.
protected
static
string
TileXYToQuadKey(
int
tileX,
int
tileY,
int
levelOfDetail)
{
var quadKey =
new
StringBuilder();
for
(
int
i = levelOfDetail; i > 0; i--)
{
char
digit =
'0'
;
int
mask = 1 << (i - 1);
if
((tileX & mask) != 0)
digit++;
if
((tileY & mask) != 0)
{
digit++;
digit++;
}
quadKey.Append(digit);
}
return
quadKey.ToString();
}
All the best,
Andrey Murzov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>