(转)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 ...
随机推荐
- 【codeforces 801B】Valued Keys
[题目链接]:http://codeforces.com/contest/801/problem/B [题意] 定义一个对两个字符串x,y的f(x,y)函数; 返回的是一个字符串; 这个返回的字符串的 ...
- ActiveMQ学习总结(5)——Java消息服务JMS详解
JMS: Java消息服务(Java Message Service) JMS是用于访问企业消息系统的开发商中立的API.企业消息系统可以协助应用软件通过网络进行消息交互. JMS的编程过程很简单,概 ...
- F - Many Moves
F - Many Moves Time limit : 2sec / Memory limit : 256MB Score : 900 points Problem Statement There a ...
- Master Nginx(6) - The Nginx HTTP Server
Nginx's architecture The HTTP core module The server Logging Finding files Name resolution Client in ...
- CentOS6.5下修改MySQL编码方法
1.查看默认编译,默认登陆到mysql后,通过show variable like命令来查看系统变量 可以看到,默认的数据库编码方式基本设置成了latin1的编译方式,此时我们需要将其修改成utf8的 ...
- Spring MVC-视图解析器(View Resolverr)-内部资源视图解析器(Internal Resource View Resolver)示例(转载实践)
以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_internalresourceviewresolver.htm 说明:示例基于S ...
- v$open_cursor中的相同record
之前在查看v$open_cursor的时候,发现很多相同的record. 让我很疑惑, sid saddr sql_id 都相同,我就想 这不是一个cursor吗? 那为什么在open_cursor中 ...
- BZOJ 1492 货币兑换 cdq分治或平衡树维护凸包
题意:链接 方法:cdq分治或平衡树维护凸包 解析: 这道题我拒绝写平衡树的题解,我仅仅想说splay不要写挂,insert边界条件不要忘.del点的时候不要脑抽d错.有想写平衡树的去看140142或 ...
- 源代码管理之Git命令的使用
目录 02.源代码管理之Git命令的使用 2.Git命令行演练-个人开发 2.1 如何学习git指令 2.2 初始化创建本地仓库 2.3 个人开发基本演练 2.4 Git的基本常识 3.Git命令行演 ...
- 四大传值详解:属性传值,单例传值,代理传值,block传值
一:属性传值 传值情景:从前一个页面向后一个页面传值 a.在后一个页面,根据传值类型和个数,写属性 b.在前一个页面, 为属性赋值 c.在后一个页面, 使用值 例如: 第一个视图: #import & ...