(转)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 ...
随机推荐
- RestEasy 用户指南----第7章 @HeaderParam
转载说明出处:http://blog.csdn.net/nndtdx/article/details/6870391 原文地址 http://docs.jboss.org/resteasy/docs/ ...
- HDU - 3556 - Continued Fraction
先上题目: Continued Fraction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Jav ...
- [bzoj3339]Rmq Problem||[bzoj3585]mex_线段树
Rmq Problem bzoj-3339||mex bzoj-3585 题目大意:给定一个长度为n的数列a,多次讯问区间l,r中最小的不属于集合{$A_l,A_{l+1}...A_r$}的非负整数. ...
- github在README中展示demo
2017年更新,现在github再master分支直接就可以操作,所以我改了这篇文章 问题所在? 解决办法? 博主建议? 一:问题的所在 相信很多小胖友们在把自己的网页上传到github仓库中,都 ...
- 网站配置https(腾讯云域名操作)
我们都知道http协议是超文本传输协议,早期的网站使用的都是http,但是并不安全,数据在传输过程中容易被拦截篡改.所以后面有了https,也就是经过ssl加密的http协议.本文主要对网站配置htt ...
- qt on android之GPS信号的获取
0. 写在最前面 本人參考安晓辉大侠的一篇博文后.做了Qt on android的GSP相关的实验.为了后面不时之需.故而记录下来. 1. Qt on Android GPS系统流 ...
- 2.2-VLAN间路由
2.2-VLAN间路由 第一代LAN间的通信: 不支持VLAN的交换机:由一个路由器和几个交换机组成,每个交换机的所有端口都同属于一个网段/LAN:在路由器上有几个网段就有几个与之相对 ...
- 创建hive整合hbase的表总结
[Author]: kwu 创建hive整合hbase的表总结.例如以下两种方式: 1.创建hive表的同步创建hbase的表 CREATE TABLE stage.hbase_news_compan ...
- DotNetBar.Bar作为容器使用的方法及Text更新原理
DotNetBar.Bar作为容器使用的方法及Text更新原理 老帅 一.容器用法 控件DevComponents.DotNetBar.Ba ...
- 为什么是kafka?
MQ在分布式场景下的应用已经非常广泛了.可是在全部的MQ使用场景中,大多都要求不能丢消息.意味着必须有持久化的能力,传统行业经常使用的activemq.rabbitmq尽管有持久化能力,无奈的是性能太 ...