ArcGIS Silverlight API访问天地图服
天地图服务是经过缓存的数据,所以需要继承的是TiledMapServiceLayer;继承的这个图层,需要收集到以下几个信息:
n Tiling Scheme Origin
n 切图的范围,也就是FullExtent
n SpatialReference
n TileInfo,包括切图的大小,级数,以及每级的Resolution
n 最后就是重写GetTileUrl方法
当地图控件的范围改变时,能够获取到当前范围的信息,那么只要把左上角和右下角之间的Tile全部按顺序显示出来就行了。
天地图图层(TDTTileLyr)重载TiledMapServiceLayer
public class TDTTileLyr : TiledMapServiceLayer
{
public override void Initialize()
{
this.FullExtent = new
ESRI.ArcGIS.Client.Geometry.Envelope(-180, -90, 180, 90);
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326);
};
this.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326);
this.TileInfo = new TileInfo()
{
Height = 256,
Width = 256,
Origin = new ESRI.ArcGIS.Client.Geometry.MapPoint(-180,90)
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326)
},
Lods = new Lod[16]
};
TileInfo.Lods[0] = new Lod() { Resolution = 0.703125 };
TileInfo.Lods[1] = new Lod() { Resolution = 0.3515625 };
TileInfo.Lods[2] = new Lod() { Resolution = 0.17578125 };
TileInfo.Lods[3] = new Lod() { Resolution = 0.087890625 };
TileInfo.Lods[4] = new Lod() { Resolution = 0.0439453125 };
TileInfo.Lods[5] = new Lod() { Resolution = 0.02197265625 };
TileInfo.Lods[6] = new Lod() { Resolution = 0.010986328125 };
TileInfo.Lods[7] = new Lod() { Resolution = 0.0054931640625 };
TileInfo.Lods[8] = new Lod() { Resolution = 0.00274658203124999 };
TileInfo.Lods[9] = new Lod() { Resolution = 0.001373291015625 };
TileInfo.Lods[10] = new Lod() { Resolution = 0.0006866455078125 };
TileInfo.Lods[11] = new Lod() { Resolution = 0.000343322753906249 };
TileInfo.Lods[12] = new Lod() { Resolution = 0.000171661376953125 };
TileInfo.Lods[13] = new Lod() { Resolution = 0.0000858306884765626 };
TileInfo.Lods[14] = new Lod() { Resolution = 0.0000429153442382813 };
TileInfo.Lods[15] = new Lod() { Resolution = 0.0000214576721191406 };
base.Initialize();
}
private string _url = "";
public override string GetTileUrl(int level, int row, int col)
{
string url = _url + "&X=" + col.ToString() + "&Y=" + row.ToString() + "&L=" + level.ToString();
return url;
}
public string Url
{
get
{
return _url;
}
set
{
_url = value;
}
}
}
访问天地图影像切片服务
TDTTileLyr p = new TDTTileLyr();
p.Url = “http://tile0.tianditu.com/DataServer?T=sbsm0210“;
p.ID = “YINGXIANG”;
p.Visible = true;
mainMap.Layers.Add(p);
点击图片可在新窗口打开
访问天地图矢量切片服务
TDTTileLyr p = new TDTTileLyr();
p.Url = ” http://tile0.tianditu.com/DataServer?T=A0512_EMap“;
p.ID = “SHILIANG”;
p.Visible = true;
mainMap.Layers.Add(p);
点击图片可在新窗口打开
影像服务、注记服务叠加显示
//注记
TDTTileLyr p = new TDTTileLyr();
p.Url = “http://tile0.tianditu.com/DataServer?T=A0610_ImgAnno“;
p.ID = “ZJ”;
p.Visible = true;
//影像服务
TDTTileLyr p1 = new TDTTileLyr();
p1.Url = “http://tile0.tianditu.com/DataServer?T=sbsm0210“;
p1.ID = “YINGXIANG”;
p1.Visible = true;
mainMap.Layers.Add(p1);
mainMap.Layers.Add(p);
天地图服务资源
http://www.tianditu.com/guide/resource.jsp
天地图影像服务地址
http://tile0.tianditu.com/DataServer?T=sbsm0210 (1-10级)
http://tile0.tianditu.com/DataServer?T=e11 (11级)
http://tile0.tianditu.com/DataServer?T=e12 (12级)
http://tile0.tianditu.com/DataServer?T=e13 (13级)
http://tile0.tianditu.com/DataServer?T=eastdawnall (14级)
http://tile0.tianditu.com/DataServer?T=sbsm1518 (15-18级)
初始范围:111.9, 27.85, 114.25, 28.67
天地图矢量地图服务地址
http://tile0.tianditu.com/DataServer?T=A0512_EMap (1-10级)
http://tile0.tianditu.com/DataServer?T=B0627_EMap1112 (11-12级)
http://tile0.tianditu.com/DataServer?T=siwei0608 (13-18级)
天地图影像注记服务地址
http://tile0.tianditu.com/DataServer?T=A0610_ImgAnno (中文地名注记)
http://tile0.tianditu.com/DataServer?T=A0104_ImgAnnoE (英文地名注记)
http://tile0.tianditu.com/DataServer?T=siweiAnno68 (注记)
天地图矢量注记服务地址
http://tile0.tianditu.com/DataServer?T=AB0512_Anno (中文地名注记)
http://tile0.tianditu.com/DataServer?T=AB0106_AnnoE (英文地名注记)
上一篇: 未完 Java: IO & NIO(new I/O)
下一篇: sqlite 导入 导出