博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
arcgis js 加载动态层图片
阅读量:6311 次
发布时间:2019-06-22

本文共 3461 字,大约阅读时间需要 11 分钟。

define([     "dojo/_base/declare",     "dojo/_base/lang",     "esri/layers/DynamicMapServiceLayer",     "esri/geometry/Extent" ], function(     declare,     lang,     DynamicMapServiceLayer,     Extent ) {
return declare("DynamicMapSuperPost", DynamicMapServiceLayer, { // create DynamicMapLayer by extending esri.layers.TiledMapServiceLayer constructor:function(){
this.spatialReference = new esri.SpatialReference({wkid:4490}); this.initialExtent = this.fullExtent = new Extent({"xmin":109.3868865977334,"ymin":29.938091498799054,"xmax":117.6127404019528,"ymax":37.81307950094276,"spatialReference": this.spatialReference}); this.loaded = true; this.onLoad(this); }, getImageUrl: function(extent, width, height, callback) {
var params = {
//request: "GetMap", //transparent: true, format: "png",//"image/png", //bgcolor: "ffffff", //version: "1.1.1", layers: 'id1,id2,id3,id4', //styles: "default,default", //exceptions: "application/vnd.ogc.se_xml", //changing values bbox: extent.xmin + "," + extent.ymin + "," + extent.xmax + "," + extent.ymax, //bbox:'113.68330445912024,34.75990865047065,113.71526537935056,34.77527045072429', MAPID: 110, //GRAY:0, //LAYERHIDEOID:'`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^', //LAYERHIDEOID:'`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^`^', //srs: "EPSG:" + extent.spatialReference.wkid, width: width, height: height }; var curParams = dojo.objectToQuery(params); var _self = this; var curentImgId = this._img_loading.id;        //这个地方是使用了servlet返回动态层的png图片,原因是有些动态层是定制的,要符合他们要求 var url = '../proxy'; var xhr = new XMLHttpRequest(); xhr.responseType = 'blob'; xhr.open('POST', url, true);//POST请求,请求地址,是否异步 xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded') xhr.onload = function (ev) {
if (this.status == 200) {
var data = this.response; var blob = new Blob(); blob = data; var blobImage = window.URL.createObjectURL(blob); if (_self._img_loading && _self._img_loading.id == curentImgId) {
callback(blobImage); } else {//缩放或移动中img被arcgis删除了,丢失dom节点 window.URL.revokeObjectURL(blobImage);//释放 } } } xhr.send(curParams); }, _imgSrcFunc: function (a) {
this._img_loading.src = a this._img_loading.onload = function () {
window.URL.revokeObjectURL(this.src);//释放 } } }); });

转载于:https://www.cnblogs.com/aoeuy/p/9629143.html

你可能感兴趣的文章
一个简单的HTML5摇一摇实例
查看>>
在笛卡尔坐标系上描绘函数2*x+Math.sqrt(5-x*x)及其共轭函数2*x-Math.sqrt(5-x*x)曲线
查看>>
ORA-28000: the account is locked-的解决办法
查看>>
ruby的字符串
查看>>
状态图试验
查看>>
指南针的实现
查看>>
取消掉Transfer-Encoding:chunked
查看>>
简单几步配置gitlab
查看>>
AppCompat学习(1)-AppCompatSpinner
查看>>
C++语言基础(17)-运算符重载
查看>>
C#中HashTable的用法
查看>>
HTTP协议详解(转)
查看>>
【资源页】(文章、工具等)
查看>>
哎,就硬盘还不是最掉价的,1999的自配主机,VIRTUALBOX里虚拟机,聊以自慰吧。...
查看>>
了解你的家公家IP
查看>>
需求用例分析之三:补充规约
查看>>
Employing Managed Profiles
查看>>
Android TextView 高亮字体并添加点击事件
查看>>
本地或者服务器同时启动2个或多个tomcat
查看>>
ProgressBar的简单使用
查看>>