ArcGIS Web API 接入天地图瓦片

0
分享 2013-05-16
接入天地图的瓦片完全类似google的瓦片服务,但是空间参考不一致,想叠加其他的数据的话需要注意空间参考的设置,以上三篇博客的目的为简单的技术研究,如果想将这些内容用于商业用途,大家还是要联系厂家啊!
publicclasstianditu :TiledMapServiceLayer
{
publicstring _mapType = null;
privatestring _hosts = new string { “tile0″, “tile1″, “tile2″, “tile3″, “tile4″, “tile5″, “tile6″, “tile6″, “tile7″ };
publicoverridevoid Initialize()
{
this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(180,-90,-180,90); {
SpatialReference = newESRI.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(-90d,45d) {
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326)
},
Lods = new Lod[18]
};
double resolution = 0.3515625;
for (int i = 0; i <TileInfo.Lods.Length; i++)
{
TileInfo.Lods = new Lod() { Resolution = resolution };
resolution /= 2;
}
base.Initialize();
}
publicoverridestring GetTileUrl(int level, int row, int col)
{
int index = Math.Abs(col % 7);
string host = _hosts[index];
string url=“”;
if(_mapType== “map”)
{
if (level < 10)
{
url=string.Format(“http://{0}.tianditu.com/DataServer?T=A0512_EMap&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level+1);
}
else if (level < 12)
{
url=string.Format(“http://{0}.tianditu.com/DataServer?T=B0627_EMap1112&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level+1);
}
else
{
url=string.Format(“http://{0}.tianditu.com/DataServer?T=siwei0608&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level+1);
}
}
if (_mapType == “Vanno”)
{
if (level < 10)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=AB0512_Anno&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
}
if (_mapType == “img”)
{
if (level < 10)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=sbsm0210&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
else if (level == 10)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=e11&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
else if (level == 11)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=e12&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
else if (level == 12)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=e13&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
else if (level == 13)
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=eastdawnall&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
else
{
url = string.Format(“http://{0}.tianditu.com/DataServer?T=sbsm1518&amp;X={1}&amp;Y={2}&amp;L={3}”, host, col, row, level + 1);
}
}
return url;
}
}

文章来源:http://blog.csdn.net/sydbc/article/details/17258119

0 个评论

要回复文章请先登录注册