(转)OL记载Arcgis Server切片
http://blog.csdn.net/gisshixisheng/article/details/47955787
概述:
本文讲述如何在OpenLayers中调用Arcgis Server切片并显示。
思路:
在OpenLayers中加载Arcgis Server切片用XYZ图层,Arcgis Server的切片调用地址我们可以看到如下:

可以看到,切片的请求地址为http://localhost:6080/arcgis/rest/services/china/MapServer/z/y/x,其中,z为缩放级别,x,y分别为改切片距离tileOrigin的行列号,其计算方式为:
- var res = this.getResolution();
- var originTileX = (this.tileOrigin.lon + (res * this.tileSize.w/2));
- var originTileY = (this.tileOrigin.lat - (res * this.tileSize.h/2));
- var center = bounds.getCenterLonLat();
- var point = { x: center.lon, y: center.lat };
- var x = (Math.round(Math.abs((center.lon - originTileX) / (res * this.tileSize.w))));
- var y = (Math.round(Math.abs((originTileY - center.lat) / (res * this.tileSize.h))));
- var z = this.map.getZoom();
将之封装为一个OpenLayers扩展类OpenLayers.Layer.AgsTileLayer,该类的代码方式为:
- OpenLayers.Layer.AgsTileLayer = OpenLayers.Class(OpenLayers.Layer.XYZ, {
- url: null,
- tileOrigin: null,
- tileSize: new OpenLayers.Size(256, 256),
- type: 'png',
- useScales: false,
- overrideDPI: false,
- initialize: function(name, url, options) {
- OpenLayers.Layer.XYZ.prototype.initialize.apply(this, arguments);
- },
- getURL: function (bounds) {
- var res = this.getResolution();
- var originTileX = (this.tileOrigin.lon + (res * this.tileSize.w/2));
- var originTileY = (this.tileOrigin.lat - (res * this.tileSize.h/2));
- var center = bounds.getCenterLonLat();
- var point = { x: center.lon, y: center.lat };
- var x = (Math.round(Math.abs((center.lon - originTileX) / (res * this.tileSize.w))));
- var y = (Math.round(Math.abs((originTileY - center.lat) / (res * this.tileSize.h))));
- var z = this.map.getZoom();
- var url = this.url;
- var s = '' + x + y + z;
- if (OpenLayers.Util.isArray(url)) {
- url = this.selectUrl(s, url);
- }
- url = url + '/tile/${z}/${y}/${x}';
- url = OpenLayers.String.format(url, {'x': x, 'y': y, 'z': z});
- return OpenLayers.Util.urlAppend(
- url, OpenLayers.Util.getParameterString(this.params)
- );
- },
- CLASS_NAME: 'OpenLayers.Layer.AgsTileLayer'
- });
调用方式为:
- <script src="AgsTileLayer.js"></script>
- var tiled = new OpenLayers.Layer.AgsTileLayer( "AGSCache",
- "http://localhost:6080/arcgis/rest/services/china/MapServer", {
- isBaseLayer: true,
- tileSize: new OpenLayers.Size(256, 256),
- resolutions: [
- 0.07614275218656896,
- 0.03807137609328448,
- 0.01903568804664224,
- 0.00951784402332112,
- 0.00475892201166056
- ],
- tileOrigin: new OpenLayers.LonLat(-400 , 400),
- maxExtent: bounds,
- projection: 'EPSG:4326'
- });
- map.addLayers([tiled]);
代码中涉及到的参数可以从http://localhost:6080/arcgis/rest/services/china/MapServer?f=pjson返回的JSON数据中获取,如下:
- {
- "capabilities" : "Map,Query,Data",
- "copyrightText" : "",
- "currentVersion" : 10.110,
- "description" : "",
- "documentInfo" : {
- "AntialiasingMode" : "None",
- "Author" : "",
- "Category" : "",
- "Comments" : "",
- "Keywords" : "",
- "Subject" : "",
- "TextAntialiasingMode" : "Force",
- "Title" : ""
- },
- "fullExtent" : {
- "spatialReference" : {
- "latestWkid" : 4326,
- "wkid" : 4326
- },
- "xmax" : 134.9767976465060,
- "xmin" : 73.45100463562233,
- "ymax" : 53.53194315222358,
- "ymin" : 18.16324718764174
- },
- "initialExtent" : {
- "spatialReference" : {
- "latestWkid" : 4326,
- "wkid" : 4326
- },
- "xmax" : 138.0530872970502,
- "xmin" : 70.37471498507816,
- "ymax" : 55.85657468506156,
- "ymin" : 35.30335092712114
- },
- "layers" : [
- {
- "defaultVisibility" : true,
- "id" : 0,
- "maxScale" : 0,
- "minScale" : 0,
- "name" : "province",
- "parentLayerId" : -1,
- "subLayerIds" : null
- },
- {
- "defaultVisibility" : true,
- "id" : 1,
- "maxScale" : 0,
- "minScale" : 0,
- "name" : "bcity",
- "parentLayerId" : -1,
- "subLayerIds" : null
- },
- {
- "defaultVisibility" : true,
- "id" : 2,
- "maxScale" : 0,
- "minScale" : 0,
- "name" : "bcounty",
- "parentLayerId" : -1,
- "subLayerIds" : null
- }
- ],
- "mapName" : "Layers",
- "maxImageHeight" : 2048,
- "maxImageWidth" : 2048,
- "maxRecordCount" : 1000,
- "maxScale" : 1000000,
- "minScale" : 32000000,
- "serviceDescription" : "",
- "singleFusedMapCache" : true,
- "spatialReference" : {
- "latestWkid" : 4326,
- "wkid" : 4326
- },
- "supportedImageFormatTypes" : "PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP",
- "supportedQueryFormats" : "JSON, AMF",
- "supportsDynamicLayers" : false,
- "tables" : [],
- "tileInfo" : {
- "cols" : 256,
- "compressionQuality" : 0,
- "dpi" : 96,
- "format" : "PNG",
- "lods" : [
- {
- "level" : 0,
- "resolution" : 0.07614275218656896,
- "scale" : 32000000
- },
- {
- "level" : 1,
- "resolution" : 0.03807137609328448,
- "scale" : 16000000
- },
- {
- "level" : 2,
- "resolution" : 0.01903568804664224,
- "scale" : 8000000
- },
- {
- "level" : 3,
- "resolution" : 0.009517844023321120,
- "scale" : 4000000
- },
- {
- "level" : 4,
- "resolution" : 0.004758922011660560,
- "scale" : 2000000
- },
- {
- "level" : 5,
- "resolution" : 0.002379461005830280,
- "scale" : 1000000
- }
- ],
- "origin" : {
- "x" : -400,
- "y" : 400
- },
- "rows" : 256,
- "spatialReference" : {
- "latestWkid" : 4326,
- "wkid" : 4326
- }
- },
- "units" : "esriDecimalDegrees"
- }
(转)OL记载Arcgis Server切片的更多相关文章
- OL记载Arcgis Server切片
概述: 本文讲述怎样在OpenLayers中调用Arcgis Server切片并显示. 思路: 在OpenLayers中载入Arcgis Server切片用XYZ图层,Arcgis Server的切片 ...
- ArcGIS Server开发教程系列(3)切片
切片工作,我们可以一级一级的切,也可以,所有的一块切,Recreate All Tiles这项是说,在没有进行任何的切片工作时,可以选用这项:Recreate Empty Tiles这项是说,如果之前 ...
- ArcGIS Server较早版本切片迁移注意事项
原创文章,转载须标明出处自: http://www.cnblogs.com/gisspace/p/8286838.html -------------------------------------- ...
- arcgis server 无法手动删除切片
背景 问题 场景如下: 切片放置在专门的文件服务器上,通过unc共享路径对外共享.文件服务器的OS为windows server2008R2 想手动更新切片服务的切片.发现同一切片服务,有的比例级别文 ...
- ArcGIS Server 10.4切片图的制作与发布
场景:有一张遥感卫星图,需要以切片图的形式发布 需要的资料:tif的格式遥感图像 发布步骤: 1.选择Service Editor-->Parameters-->Anti-Aliasing ...
- arcgis server地图服务切片(10.4.1)
首先要发布地图服务,过程略 首先,熟悉arcgis server的人应该知道,最直接的切片方式操作方法是在“服务属性”中设置切片,但这种方式可操作性太差,很多设置无法实现,因此不推荐 下面正式开始,打 ...
- Arcgis, ArcEngine, Arcgis Server使用开发汇总 索引
ArcGIS系列软件license及安装: Arcgis SDE10.1 和 Arcgis server10.1的授权文件license tnt_esri.dat Arcgis8.1安装license ...
- ArcGIS API for JavaScript(2)-ArcGIS Server发布要素图层服务
1.前言 上一篇该系列的文章我们主要讲了一下基础Web地图搭建,这篇我们主要讲一下ArcGIS Server发布服务,并且如何调用服务.将自己的数据加载到Web地图当中来,实现Web端浏览数据. 2. ...
- ArcGIS Server开发教程系列(7)使用ArcGIS API for Javascript-Hello World
ArcGIS API for Javascript API下载地址:http://support.esrichina-bj.cn/2011/0223/960.html 选择最新的下载就好了,目前是3 ...
随机推荐
- P1464 Function 洛谷
https://www.luogu.org/problem/show?pid=1464 题目描述 对于一个递归函数w(a,b,c) 如果a<=0 or b<=0 or c<=0就返回 ...
- Graphics简单汇总
1.主页面布局文件 activity_main.xml(仅仅有2个button按钮) <?xml version="1.0" encoding="utf-8&quo ...
- Java 设计模式—装饰者模式
在Java编程语言中,嵌套了非常多设计模式的思想,比如IO流中的缓冲流就使用到以下要介绍的装饰者设计模式. 演示样例代码: * 抽象构件角色:定义一个抽象接口,来规范准备附加功能的类 * @autho ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
(1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...
- 海思3518e mpp2/sample/venc makefile简析
http://blog.csdn.net/u011003120/article/details/51324567
- hdu 1695(莫比乌斯反演)
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- Autobiography
Autobiography My name is Donggongdechen. I am ** years old. I was born in XuChang, HeNan province, t ...
- 网上订餐系统的SQL SERVER 2005数据库连接
- E20170808-mk
Backtick 反引号 import n. 输入; 进口,进口商品 triggered adj. 触发的;
- Android插件化原理解析——Hook机制之动态代理
转自 http://weishu.me/2016/01/28/understand-plugin-framework-proxy-hook/ 使用代理机制进行API Hook进而达到方法增强是框架的常 ...