(转)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 ...
随机推荐
- [置顶]
Git学习总结(1)——Git使用详细教程
一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以 ...
- HDU 3401 Trade
Trade Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 3401 ...
- Android音乐、视频类APP常用控件:DraggablePanel(1)
Android音乐.视频类APP常用控件:DraggablePanel(1) Android的音乐视频类APP开发中,常涉及到用户拖曳视频.音乐播放器产生一定交互响应的设计需求,最典型的以You ...
- printf()参数的处理
下面程序的输出为? #include <stdio.h> int main(void) { ,b=,c=; printf(),(c = c*)); ; } 答案是110..40..60 这 ...
- [bzoj4154][Ipsc2015]Generating Synergy_KD-Tree_dfs序
Generating Synergy bzoj-4154 Ipsc-2015 题目大意:给定一棵n个节点树,m个操作,支持:将一个点周围所有距该点距离不超过l的子结点的颜色改成另一种颜色:查询单点颜色 ...
- [poj3735] Training little cats_矩乘快速幂
Training little cats poj-3735 题目大意:给你n个数,k个操作,将所有操作重复m次. 注释:三种操作,将第i个盒子+1,交换两个盒子中的个数,将一个盒子清空.$1\le m ...
- 【LeetCode OJ 232】Implement Queue using Stacks
题目链接:https://leetcode.com/problems/implement-queue-using-stacks/ 题目:Implement the following operatio ...
- 学习笔记——SQL SERVER的递归
SQL SERVER似乎天然具有支持递归的属性. 1.比如说,有几次,我编写或修改存储过程的时候,为图方便,在末尾随手写上 执行这个存储过程 的语句,比如 [sql] view plaincopy A ...
- 背包问题的方案总数 P1474 货币系统
背包问题的方案总数 对于一个给定了背包容量.物品费用.物品间相互关系(分组.依赖等)的背包问题,除了再给定每个物品的价值后求可得到的最大价值外,还可以得到装满背包或将背包装至某一指定容量的方案总数. ...
- 洛谷P2593 [ ZJOI 2006 ] 超级麻将 —— DP
题目:https://www.luogu.org/problemnew/show/P2593 DP的话,考虑到当前这一位只跟前两位有关,所以记录一下这3位的状态就行: 于是一开始记录的第 i 位,i- ...