arcgis api for silverlight自己写个图层,实现对OpenStreetMap的访问
来源:互联网 发布:阿里云 pop3 编辑:程序博客网 时间:2024/04/27 14:07
继承TiledMapServiceLayer,实现GetTileUrl方法。
public class OpenStreetMapLayer : TiledMapServiceLayer
{
private static string[] subDomains = { "a", "b", "c" };
private const string baseUrl = "http://{0}.tile.openstreetmap.org/{1}/{2}/{3}.png";
public override void Initialize()
{
this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892)
{
SpatialReference = new SpatialReference(102113)
};
double cornerCoordinate = 20037508.3427892;//from wkid 3857/102100
// This layer's spatial reference
this.SpatialReference = new SpatialReference(102113);
// Set up tile information. Each tile is 256x256px, 19 levels.
this.TileInfo = new TileInfo()
{
Height = 256,
Width = 256,
Origin = new MapPoint(-cornerCoordinate, cornerCoordinate) { SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102113) },
Lods = new Lod[19]
};
// Set the resolutions for each level. Each level is half the resolution of the previous one.
double resolution = cornerCoordinate * 2 / 256;
for (int i = 0; i < TileInfo.Lods.Length; i++)
{
TileInfo.Lods[i] = new Lod() { Resolution = resolution };
resolution /= 2;
}
// Call base initialize to raise the initialization event
base.Initialize();
}
public override string GetTileUrl(int level, int row, int col)
{
// Select a subdomain based on level/row/column so that it will always
// be the same for a specific tile. Multiple subdomains allows the user
// to load more tiles simultanously. To take advantage of the browser cache
// the following expression also makes sure that a specific tile will always
// hit the same subdomain.
string subdomain = subDomains[(level + col + row) % subDomains.Length];
return string.Format(baseUrl, subdomain, level, col, row);
}
}
可下载http://download.csdn.net/detail/leesmn/3634647试试效果
- arcgis api for silverlight自己写个图层,实现对OpenStreetMap的访问
- arcgis api for silverlight自己写个图层,实现对google map的访问
- ArcGIS API for Silverlight 加载BingMap,GoogleMap,WorldImageryMap,OpenStreetMap,BaiduMap方法
- ArcGIS API for Silverlight动态标绘的实现
- ArcGIS API for Silverlight 实现轨迹回放
- ArcGIS API for Silverlight 实现轨迹回放
- ArcGIS API for Silverlight 实现轨迹回放
- ArcGIS API for Silverlight 实现轨迹回放
- arcgis api for silverlight
- ArcGIS API for Silverlight中通过https访问rest服务
- 解决ArcGIS API for Silverlight 加载地图的内外网访问问题
- ArcGIS API for Silverlight 调用WebService出现跨域访问报错的解决方法
- ArcGIS API for Silverlight 调用WebService出现跨域访问报错的解决方法
- ArcGIS Editor for OpenStreetMap
- ArcGIS API FOR Silverlight资源
- ArcGIS For Silverlight api 简介
- ArCGIS API for Silverlight 实现闪烁标注功能
- ArCGIS API for Silverlight 实现闪烁标注功能
- AnimateWindow 来美化你的对话框
- RAC 修改 spfile 参数
- 全排列
- ActiveX控件和它的容器
- Linux与Windows的文本文件格式转换,解决中文乱码和换行问题
- arcgis api for silverlight自己写个图层,实现对OpenStreetMap的访问
- RAC实例 表空间 维护
- 文件扩展名大全
- AT&T汇编心得之间接寻址和LEA指令
- About a key word Static
- 清理垃圾批处理
- 远程客户端 访问 ASM 实例
- 8.2.1 函数的声明
- jdbc 基本功