arcgis中引入bingmap_第1页
arcgis中引入bingmap_第2页
arcgis中引入bingmap_第3页
arcgis中引入bingmap_第4页
arcgis中引入bingmap_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、arcgis 中引入 bingmaparcgis中引入 bingmap分类: GIS 2011-05-12 12:05 566 人阅读 评论 (0) 收藏 举报 前期:有 KEY 码。通过注册获取(1)加入 bingmap,因为是 3857 坐标系统。Spatial Reference: 102100 (3857) 102100 WGS_1984_Web_Mercator_Auxiliary_Sphere所以要作为最底图加入即可2)叠加 tile 的类:using ESRI.ArcGIS.Client;using ESRI.ArcGIS.Client.Geometry;using System

2、.Windows;using System;namespace Diligentpigpublic class ClientDynamicTileMapServiceLayer :TiledMapServiceLayerpublic bool iscansee = true;public static readonly DependencyPropertyUrlProperty = DependencyProperty.Register("Url", typeof(string), typeof(ClientDynamicTileMapServiceLayer), new

3、PropertyMetadata(newPropertyChangedCallback(ClientDynamicTileMapServiceLayer.OnUrlPropertyChanged);public string Urlget return (string)GetValue(UrlProperty); set SetValue(UrlProperty, value); public static readonly DependencyPropertyDisableClientCacheProperty =DependencyProperty.Register("Disab

4、leClientCache", typeof(bool), typeof(ClientDynamicTileMapServiceLayer), newPropertyMetadata(newPropertyChangedCallback(ClientDynamicTileMapServiceLayer.OnDisableClientCachePropertyChanged);public bool DisableClientCacheget return(bool)GetValue(DisableClientCacheProperty); set SetValue(DisableCl

5、ientCacheProperty,value); private int _visibleLayers;/ <summary>/ Set the visible layers ofDynamicTileMapServiceLayer by an int array which starts from 0./ If sets to NULL, all sublayers will be visible./ </summary>public int VisibleLayersget return _visibleLayers; set_vi

6、sibleLayers = value;if (this.IsInitialized)this.IsInitialized = false;this.InitializationFailure = null;this.Refresh();this.Initialize();private const double cornerCoordinate =20037508.3427892;public override void Initialize()this.FullExtent = newESRI.ArcGIS.Client.Geometry.Envelope(-20037508.342789

7、2, -20037508.3427892, 20037508.3427892, 20037508.3427892)SpatialReference = newSpatialReference(102100);/ This layer's spatial referencethis.SpatialReference = newSpatialReference(102100);/ Set up tile information. Each tile is 256x256px,19 levels.this.TileInfo = new TileInfo()Height = 256,Width

8、 = 256,Origin = new MapPoint(-cornerCoordinate,cornerCoordinate) SpatialReference = newESRI.ArcGIS.Client.Geometry.SpatialReference(102100) ,Lods = new Lod19;/ Set the resolutions for each level. Each level ishalf the resolution of the previous one.double resolution = cornerCoordinate * 2 / 256;for

9、(int i = 0; i < TileInfo.Lods.Length; i+)TileInfo.Lodsi = new Lod() Resolution =resolution ;resolution /= 2;/ Call base initialize to raise the initializationeventbase.Initialize();public override string GetTileUrl(int level, int row, intcol)if (iscansee)string baseUrl ="0/export?udpi=96

10、&transparent=true&format=pn g8&bbox=1%2C2%2C3%2C4&bboxSR=10 2100&imageSR=102100&size=256%2C256&f=i mage"double cornerCoordinate =20037508.3427892;/from wkid 3857/102100double originResolution = cornerCoordinate* 2 / 256;double resolution =

11、 originResolution;for (int i = 0; i < level; i+)resolution /= 2;double xmin, ymin, xmax, ymax;/double resolution = 39135.7584820001;xmin = -cornerCoordinate + resolution *256 * col;ymin = cornerCoordinate - resolution * 256* (row + 1);xmax = -cornerCoordinate + resolution *256 * (col + 1);yma

12、x = cornerCoordinate - resolution * 256* row;/string subServices = "stgeometry","stgeometry1", "stgeometry2" ;/string baseUrl ="31:8399/arcgis/rest/services/0/MapSer ver/export?dpi=96&transparent=true&format=png8& amp;bbox=1%2

13、C2%2C3%2C4&bboxSR=10210 0&imageSR=102100&size=256%2C256&f=ima ge&_ts=5"/string subservice = subServices(level +col + row) % subServices.Length;/return string.Format(baseUrl, subservice,xmin, ymin, xmax, ymax, DateTime.Now.Ticks.ToString();if (VisibleLayer

14、s != null)/if null, allsublayers are visible./ex. layers=show:2,4,7 string str = "&layers=show:"for (int i = 0; i <VisibleLayers.Length; i+)str = str.Insert(str.Length,VisibleLayersi.ToString() + ",");str = str.Remove(str.Length -1);/remove last ","baseUr

15、l =baseUrl.Insert(baseUrl.Length, str);if (DisableClientCache)layer.IsInitialized = false;baseUrl =baseUrl.Insert(baseUrl.Length, "&_ts=5");return string.Format(baseUrl, Url, xmin,ymin, xmax, ymax, DateTime.Now.Ticks.ToString();return string.Format(baseUrl, Url, xmin,ymin, xmax, ym

16、ax);else returnMH.private static voidOnUrlPropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e)tryClientDynamicTileMapServiceLayer layer =(ClientDynamicTileMapServiceLayer)d;layer.InitializationFailure = null;layer.Refresh();layer.Initialize();catch (Exception ex)MessageBox.Show(&

17、quot;ArcGISDynamicMapServiceLayer Url is invalid!/n" + ex.Message);private static voidOnDisableClientCachePropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e)ClientDynamicTileMapServiceLayer layer =(ClientDynamicTileMapServiceLayer)d;if (layer.IsInitialized)layer.IsInitializ

18、ed = false;layer.InitializationFailure = null;layer.Refresh();layer.Initialize();3)增加坐标转化系统:/经纬度转墨卡托public static Point lonLat2Mercator(Point lonLat)if (type<= 1)double x = lonLat.X * 20037508.34 / 180;double M_PI = Math.PI;double y = Math.Log(Math.Tan(90 +lonLat.Y) * M_PI / 360) / (M_PI / 18

19、0);y = y * 20037508.34 / 180;Point mercator = new Point(x, y);return mercator;elsePoint mercator = lonLat;return mercator;/墨卡托转经纬度 public static Point Mercator2lonLat(Point mercator)if (type<= 1)double x = mercator.X / 20037508.34 * 180;double y = mercator.Y / 20037508.34 * 180;double M_PI =

20、Math.PI;y = 180 / M_PI * (2 *Math.Atan(Math.Exp(y * M_PI / 180) - M_PI / 2);Point lonLat = new Point(x, y);return lonLat;elsePoint lonLat=mercator;return lonLat;/示例如下ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = feature.Geometry.Extent;double expandPercentage = 100;double widthExpand =selecte

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论