zoukankan      html  css  js  c++  java
  • arcgis动态层改post请求

    有时候重写 DynamicMapServiceLayer后参数太多要用post请求:
    改arcgis init.js源码:
    搜索
    "esri/layers/ArcGISDynamicMapServiceLayer" 这个关键key对应的类,因为是key value形式
    找到方法getImageUrl
    _jsonRequest是esri/request的别名
    加{usePost: true}
    
    
    getImageUrl: function (b, e, g, f) {
    var k = this._url.path + "/export", q = this._params, r = q.token = this._getToken(),
    p = b.spatialReference.wkid || m.toJson(b.spatialReference.toJson()),
    t = this._errorHandler;
    delete q._ts;
    n.mixin(q, {
    bbox: b.xmin + "," + b.ymin + "," + b.xmax + "," + b.ymax,
    bboxSR: p,
    imageSR: p,
    size: e + "," + g
    }, this.disableClientCaching ? {_ts: (new Date).getTime()} : {});
    q.layerDefs && (b = d._serializeLayerDefinitions(q.layerDefs, 10.5 <= this.version), q = n.mixin({}, q), delete q.layerDefs, q.layerDefs = b);
    b = a.addProxy(a.normalize(k) + "?" + l.objectToQuery(n.mixin({}, q, {f: "image"})));
    /*
    这是原方法,现在直接改为下面的post
    b.length > h.defaults.io.postLength || this.useMapImage ? this._jsonRequest = c({
    url: k, content: n.mixin(q, {f: "json"}), callbackParamName: "callback",
    load: function (b) {
    b.imageData ? b = "data:" + (b.contentType || "image") + ";base64," + b.imageData : (b = b.href, r && (b += -1 === b.indexOf("?") ? "?tokenx3d" + r : "x26tokenx3d" + r), b = a.addProxy(b));
    f(b)
    }, error: t
    }) : f(b)
    */
    this._jsonRequest = c({
    url: k,
    content: n.mixin(q, {f: "json"}),
    callbackParamName: "callback",
    load: function (b) {
    b.imageData ? b = "data:" + (b.contentType || "image") + ";base64," + b.imageData : (b = b.href, r && (b += -1 === b.indexOf("?") ? "?tokenx3d" + r : "x26tokenx3d" + r), b = a.addProxy(b));
    f(b)
    },
    error: t
    }, {usePost: true});
    this._jsonRequest.then(function(b){
    b.imageData ? b = "data:" + (b.contentType || "image") + ";base64," + b.imageData : (b = b.href, r && (b += -1 === b.indexOf("?") ? "?tokenx3d" + r : "x26tokenx3d" + r), b = a.addProxy(b));
    f(b)
    },t);
    }

  • 相关阅读:
    [POJ] 1979 Red and Black
    [Codeforces Round #192 (Div. 2)] D. Biridian Forest
    [Codeforces Round #192 (Div. 2)] B. Road Construction
    [Codeforces Round #192 (Div. 2)] A. Cakeminator
    430 vue组件命名方式: 短横线、驼峰
    429 vue脚手架
    428 webpack 使用步骤
    427 单页面应用,vue路由
    426 vue组件
    425 json-server,axios
  • 原文地址:https://www.cnblogs.com/aoeuy/p/9613067.html
Copyright © 2011-2022 走看看