最新silverlight 调用google影像地图包含矢量标注
2013-05-22 15:57
676 查看
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
namespace sdhbgis.Dal
{
public class GoogleMapLayerImage : TiledMapServiceLayer
{
private const double cornerCoordinate = 20037508.3427892;
public override void Initialize()
{
//this.Opacity = 0.5;
this.FullExtent = new
ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787);//(-180,-85.0511287798066,180, 85.0511287798066)
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
};
this.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
//this.InitialExtent = this.FullExtent;
this.TileInfo = new TileInfo()
{
Height = 256,
Width = 256,
Origin = new ESRI.ArcGIS.Client.Geometry.MapPoint(-20037508.342787, 20037508.342787)//Origin = new ESRI.ArcGIS.Geometry.MapPoint(-180, 90)
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100)
},
Lods = new Lod[20]
};
double resolution = 156543.033928;
for (int i = 0; i < TileInfo.Lods.Length; i++)
{
TileInfo.Lods[i] = new Lod() { Resolution = resolution };
resolution /= 2;
}
base.Initialize();
//this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892)
//{
// SpatialReference = new SpatialReference(102100)
//};
//// This layer's spatial reference
//this.SpatialReference = new SpatialReference(102100);
//// 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(102100) },
// 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();
}
private string setType="2";
public string SetType
{
get { return setType; }
set { setType = value; }
}
public override string GetTileUrl(int level, int row, int col)
{
// int num = (col + (2 * row)) % 4;
// string str = "&s=";
// string str2 = "Galileo";
// int length = ((col * 3) + row) % 8;
// str = str + str2.Substring(0, length);
// if (row >= 0x2710)
// {
// }
// string str3 = "http://khm" + num.ToString() + ".google.com/kh=49&x=";
// return (str3 + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + str);
// string baseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量图
string baseUrl = "http://mt2.google.cn/vt/lyrs=s@169000000,m@169000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星图
// string cbaseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000,m@169000000&hl=zh-CN&gl=cn&x=0&y=0&z=0&s=Galil";//市区图
//if (SetType == "1")
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量
//}
//else if (SetType == "2")
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=s@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星
//}
//else
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=t@128&hl=zh-CN&gl=cn&s=Galil&x=";//地形
//}
string url = baseUrl + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + "";
// string url2 = "http://api.tiles.virtualearth.net/api/GetMap.ashx?c=" + row.ToString() + "," + col.ToString() + "&z=" + level.ToString() + "&b=h,mkt.en-US&z=4&token={token}";
//string url3 = "http://mt{0}.google.cn/vt/lyrs=s@88&gl=cn&x=";
// string ur4 = url3 + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + "";
return url;
}
}
}
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
namespace sdhbgis.Dal
{
public class GoogleMapLayerImage : TiledMapServiceLayer
{
private const double cornerCoordinate = 20037508.3427892;
public override void Initialize()
{
//this.Opacity = 0.5;
this.FullExtent = new
ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787);//(-180,-85.0511287798066,180, 85.0511287798066)
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
};
this.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
//this.InitialExtent = this.FullExtent;
this.TileInfo = new TileInfo()
{
Height = 256,
Width = 256,
Origin = new ESRI.ArcGIS.Client.Geometry.MapPoint(-20037508.342787, 20037508.342787)//Origin = new ESRI.ArcGIS.Geometry.MapPoint(-180, 90)
{
SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100)
},
Lods = new Lod[20]
};
double resolution = 156543.033928;
for (int i = 0; i < TileInfo.Lods.Length; i++)
{
TileInfo.Lods[i] = new Lod() { Resolution = resolution };
resolution /= 2;
}
base.Initialize();
//this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892)
//{
// SpatialReference = new SpatialReference(102100)
//};
//// This layer's spatial reference
//this.SpatialReference = new SpatialReference(102100);
//// 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(102100) },
// 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();
}
private string setType="2";
public string SetType
{
get { return setType; }
set { setType = value; }
}
public override string GetTileUrl(int level, int row, int col)
{
// int num = (col + (2 * row)) % 4;
// string str = "&s=";
// string str2 = "Galileo";
// int length = ((col * 3) + row) % 8;
// str = str + str2.Substring(0, length);
// if (row >= 0x2710)
// {
// }
// string str3 = "http://khm" + num.ToString() + ".google.com/kh=49&x=";
// return (str3 + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + str);
// string baseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量图
string baseUrl = "http://mt2.google.cn/vt/lyrs=s@169000000,m@169000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星图
// string cbaseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000,m@169000000&hl=zh-CN&gl=cn&x=0&y=0&z=0&s=Galil";//市区图
//if (SetType == "1")
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量
//}
//else if (SetType == "2")
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=s@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星
//}
//else
//{
// baseUrl = "http://mt2.google.cn/vt/lyrs=t@128&hl=zh-CN&gl=cn&s=Galil&x=";//地形
//}
string url = baseUrl + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + "";
// string url2 = "http://api.tiles.virtualearth.net/api/GetMap.ashx?c=" + row.ToString() + "," + col.ToString() + "&z=" + level.ToString() + "&b=h,mkt.en-US&z=4&token={token}";
//string url3 = "http://mt{0}.google.cn/vt/lyrs=s@88&gl=cn&x=";
// string ur4 = url3 + col.ToString() + "&y=" + row.ToString() + "&z=" + level.ToString() + "";
return url;
}
}
}
相关文章推荐
- 最新silverlight调用google城市地图(矢量)
- 最新silverlight调用google地形图包含矢量
- Google离线API地图调用示例源码功能
- js 调用百度地图api并在地图上进行打点添加标注
- Google 地图原本为什么不采用矢量地图渲染,而是下载栅格化图像然后渲染?
- google 将推出最新版的地图
- ArcGIS API for Flex 调用天地图和Google地图服务
- Jsp 页面 调用 google API 地图的实现
- Google 地图为什么不采用矢量地图渲染的方式,而是下载栅格化图像然后渲染的方式?
- 全国2013年最新电子地图矢量数据超图格SGD、MAPINFO、GST、SMW、SHP格式等
- arcgis 本地地图服务 silverlight 调用报错
- [置顶] ARCGIS进行地理配准及影像配准并加载到谷歌地球中查看矢量地图SHP
- Silverlight Map 矢量地图构建过程分析
- React实战-如何在ReactJs中调用Google、Baidu地图
- 支持多次调用 jq.contentShown 升级,带最新最全的演示以及更多的说明(包含内容轮显示例)
- 最新Google分析中的函数调用
- js 调用百度地图api,并在地图上进行打点,添加标注
- 如何在CAD中将矢量地图与卫星影像完美叠加
- google 地图和baidu地图 在android上的实现过程和对比 包含 自定义图层的绘制
- Silverlight学习笔记十七BingMap(四)之部署Google地图系统