我是Windows Phone开发的新手,目前正在为一家希望使用自己的地图(构建地图磁贴)的公司构建一个应用程序。我想在解决方案中使用BingMap silverlight控件。我的问题是:这真的可能吗?我尝试通过继承MapTiles类来覆盖"GetUri“方法,如下所示;
public class MyTiles : Microsoft.Phone.Controls.Maps.TileSource
{
public override Uri GetUri(int x, int y, int zoomLevel)
{
if (zoomLevel > 0)
{
var Url = string.Format(UriFormat, Server, MapMode, zoomLevel, x, y);
return new Uri(Url);
}
return null;
}
}有没有可能在没有HTTP请求的情况下加载地图磁贴?
非常感谢你提前
Nroblex
发布于 2014-02-23 21:36:56
不幸的是,唯一的方法是在互联网上托管磁贴:http://social.msdn.microsoft.com/Forums/en-US/94c2d9bc-f1a7-4201-9e5a-4d6a47d285cb/maptilelayer-with-local-tiles?forum=bingmapswindows8
在开发过程中,您可以尝试使用WAMP (http://www.wampserver.com/en/),然后使用本地主机上的tiles:
MapTileLayer tileLayer = new MapTileLayer();
tileLayer.GetTileUri += tileLayer_GetTileUri;
private void tileLayer_GetTileUri(object sender, GetTileUriEventArgs e)
{
string quadkey = TileToQuadkey(e.X, e.Y, e.LevelOfDetail);
e.Uri = new Uri(String.Format("http://localhost/tiles/{0}.png", quadkey));
}这里描述了TileToQuadkey方法:http://msdn.microsoft.com/en-us/library/bb259689.aspx
但是对于生产环境,您需要用您自己的web服务器替换WAMP。
https://stackoverflow.com/questions/10316784
复制相似问题