An error occurred in "ArcGisMapServerImageryProvider": Tile spatial reference WKID 4490 is not su...

在cesium添加arcgis圖層的時(shí)候锈津,會(huì)遇到這個(gè)錯(cuò)誤爆侣,顯示4490坐標(biāo)系不支持乘粒。
通過修改源碼诉稍,可以實(shí)現(xiàn)對(duì)于該數(shù)據(jù)的支持。
目前缴允,我的開發(fā)版本是1.62荚守,僅供參考

需要修改的部分有:
1.修改 ArcGisMapServerImageryProvider.js
177行

} else if(data.tileInfo.spatialReference.wkid === 4490){
    that._tilingScheme = new GeographicTilingScheme({ 
        ellipsoid : options.ellipsoid,
        tileInfo:data.tileInfo
    });
修改位置

200行

} else if (data.fullExtent.spatialReference.wkid === 4326 
|| data.fullExtent.spatialReference.wkid === 4490) {
   that._rectangle = Rectangle.fromDegrees(data.fullExtent.xmin, data.fullExtent.ymin, 
      data.fullExtent.xmax, data.fullExtent.ymax);
image.png

2.修改GeographicTilingScheme.js
我把全文都粘貼上了,可以自己看一下

define([
        './Cartesian2',
        './Check',
        './defaultValue',
        './defined',
        './defineProperties',
        './Ellipsoid',
        './GeographicProjection',
        './Math',
        './Rectangle'
    ], function(
        Cartesian2,
        Check,
        defaultValue,
        defined,
        defineProperties,
        Ellipsoid,
        GeographicProjection,
        CesiumMath,
        Rectangle) {
    'use strict';

    /**
     * A tiling scheme for geometry referenced to a simple {@link GeographicProjection} where
     * longitude and latitude are directly mapped to X and Y.  This projection is commonly
     * known as geographic, equirectangular, equidistant cylindrical, or plate carrée.
     *
     * @alias GeographicTilingScheme
     * @constructor
     *
     * @param {Object} [options] Object with the following properties:
     * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid whose surface is being tiled. Defaults to
     * the WGS84 ellipsoid.
     * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the tiling scheme.
     * @param {Number} [options.numberOfLevelZeroTilesX=2] The number of tiles in the X direction at level zero of
     * the tile tree.
     * @param {Number} [options.numberOfLevelZeroTilesY=1] The number of tiles in the Y direction at level zero of
     * the tile tree.
     */
    function GeographicTilingScheme(options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);

        // this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
        // this._rectangle = defaultValue(options.rectangle, Rectangle.MAX_VALUE);
        // this._projection = new GeographicProjection(this._ellipsoid);
        // this._numberOfLevelZeroTilesX = defaultValue(options.numberOfLevelZeroTilesX, 2);
        // this._numberOfLevelZeroTilesY = defaultValue(options.numberOfLevelZeroTilesY, 1);
        if( defined(options.tileInfo) 
               && defined(options.tileInfo.spatialReference) 
               && defined(options.tileInfo.spatialReference.wkid)
               && options.tileInfo.spatialReference.wkid == 4490 )
           {
               this._tileInfo = options.tileInfo;
               this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.CGCS2000);
               this._rectangle = defaultValue(options.rectangle, Rectangle.fromDegrees(-180, -90, 180, 90));
               this._numberOfLevelZeroTilesX = defaultValue(options.numberOfLevelZeroTilesX, 4);
               this._numberOfLevelZeroTilesY = defaultValue(options.numberOfLevelZeroTilesY, 2);
           }
           else 
           {
               this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
               this._rectangle = defaultValue(options.rectangle, Rectangle.MAX_VALUE);
               this._numberOfLevelZeroTilesX = defaultValue(options.numberOfLevelZeroTilesX, 2);
               this._numberOfLevelZeroTilesY = defaultValue(options.numberOfLevelZeroTilesY, 1);
           }
        
           this._projection = new GeographicProjection(this._ellipsoid);
    }

    defineProperties(GeographicTilingScheme.prototype, {
        /**
         * Gets the ellipsoid that is tiled by this tiling scheme.
         * @memberof GeographicTilingScheme.prototype
         * @type {Ellipsoid}
         */
        ellipsoid : {
            get : function() {
                return this._ellipsoid;
            }
        },

        /**
         * Gets the rectangle, in radians, covered by this tiling scheme.
         * @memberof GeographicTilingScheme.prototype
         * @type {Rectangle}
         */
        rectangle : {
            get : function() {
                return this._rectangle;
            }
        },

        /**
         * Gets the map projection used by this tiling scheme.
         * @memberof GeographicTilingScheme.prototype
         * @type {MapProjection}
         */
        projection : {
            get : function() {
                return this._projection;
            }
        }
    });

    /**
     * Gets the total number of tiles in the X direction at a specified level-of-detail.
     *
     * @param {Number} level The level-of-detail.
     * @returns {Number} The number of tiles in the X direction at the given level.
     */
    GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel = function(level) {
        // return this._numberOfLevelZeroTilesX << level;
        if(!defined(this._tileInfo))
        {
            return this._numberOfLevelZeroTilesX << level;
        }
        else 
        {
            var currentMatrix = this._tileInfo.lods.filter(function(item){
                return item.level === level;
            });
            var currentResolution = currentMatrix[0].resolution;
            return Math.round(CesiumMath.toDegrees(CesiumMath.TWO_PI) / (this._tileInfo.rows * currentResolution));
        }
    };

    /**
     * Gets the total number of tiles in the Y direction at a specified level-of-detail.
     *
     * @param {Number} level The level-of-detail.
     * @returns {Number} The number of tiles in the Y direction at the given level.
     */
    GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel = function(level) {
        // return this._numberOfLevelZeroTilesY << level;
        if(!defined(this._tileInfo))
        {
            return this._numberOfLevelZeroTilesY << level;
        }
        else 
        {
            var currentMatrix = this._tileInfo.lods.filter(function(item){
                return item.level === level;
            });
            var currentResolution = currentMatrix[0].resolution;
            return Math.round(CesiumMath.toDegrees(CesiumMath.TWO_PI / 2) / (this._tileInfo.cols * currentResolution));
        }
    };

    /**
     * Transforms a rectangle specified in geodetic radians to the native coordinate system
     * of this tiling scheme.
     *
     * @param {Rectangle} rectangle The rectangle to transform.
     * @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance
     *        should be created.
     * @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result'
     *          is undefined.
     */
    GeographicTilingScheme.prototype.rectangleToNativeRectangle = function(rectangle, result) {
        //>>includeStart('debug', pragmas.debug);
        Check.defined('rectangle', rectangle);
        //>>includeEnd('debug');

        var west = CesiumMath.toDegrees(rectangle.west);
        var south = CesiumMath.toDegrees(rectangle.south);
        var east = CesiumMath.toDegrees(rectangle.east);
        var north = CesiumMath.toDegrees(rectangle.north);

        if (!defined(result)) {
            return new Rectangle(west, south, east, north);
        }

        result.west = west;
        result.south = south;
        result.east = east;
        result.north = north;
        return result;
    };

    /**
     * Converts tile x, y coordinates and level to a rectangle expressed in the native coordinates
     * of the tiling scheme.
     *
     * @param {Number} x The integer x coordinate of the tile.
     * @param {Number} y The integer y coordinate of the tile.
     * @param {Number} level The tile level-of-detail.  Zero is the least detailed.
     * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
     *        should be created.
     * @returns {Rectangle} The specified 'result', or a new object containing the rectangle
     *          if 'result' is undefined.
     */
    GeographicTilingScheme.prototype.tileXYToNativeRectangle = function(x, y, level, result) {
        var rectangleRadians = this.tileXYToRectangle(x, y, level, result);
        rectangleRadians.west = CesiumMath.toDegrees(rectangleRadians.west);
        rectangleRadians.south = CesiumMath.toDegrees(rectangleRadians.south);
        rectangleRadians.east = CesiumMath.toDegrees(rectangleRadians.east);
        rectangleRadians.north = CesiumMath.toDegrees(rectangleRadians.north);
        return rectangleRadians;
    };

    /**
     * Converts tile x, y coordinates and level to a cartographic rectangle in radians.
     *
     * @param {Number} x The integer x coordinate of the tile.
     * @param {Number} y The integer y coordinate of the tile.
     * @param {Number} level The tile level-of-detail.  Zero is the least detailed.
     * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
     *        should be created.
     * @returns {Rectangle} The specified 'result', or a new object containing the rectangle
     *          if 'result' is undefined.
     */
    GeographicTilingScheme.prototype.tileXYToRectangle = function(x, y, level, result) {
        // var rectangle = this._rectangle;

        // var xTiles = this.getNumberOfXTilesAtLevel(level);
        // var yTiles = this.getNumberOfYTilesAtLevel(level);

        // var xTileWidth = rectangle.width / xTiles;
        // var west = x * xTileWidth + rectangle.west;
        // var east = (x + 1) * xTileWidth + rectangle.west;

        // var yTileHeight = rectangle.height / yTiles;
        // var north = rectangle.north - y * yTileHeight;
        // var south = rectangle.north - (y + 1) * yTileHeight;

        // if (!defined(result)) {
        //     result = new Rectangle(west, south, east, north);
        // }

        // result.west = west;
        // result.south = south;
        // result.east = east;
        // result.north = north;
        // return result;
        var rectangle = this._rectangle;
        
        var west = 0;
        var east = 0;
        
        var north = 0;
        var south = 0;
        
        if(defined(this._tileInfo))
        {
            var currentMatrix = this._tileInfo.lods.filter(function(item){
                return item.level === level;
            });
            var currentResolution = currentMatrix[0].resolution;
        
            north = this._tileInfo.origin.y - y * (this._tileInfo.cols * currentResolution);
            west = this._tileInfo.origin.x + x * (this._tileInfo.rows * currentResolution);
        
            south = this._tileInfo.origin.y - (y + 1) * (this._tileInfo.cols * currentResolution);
            east = this._tileInfo.origin.x + (x + 1) * (this._tileInfo.rows * currentResolution);
        
            west = CesiumMath.toRadians(west);
            north = CesiumMath.toRadians(north);
            east = CesiumMath.toRadians(east);
            south = CesiumMath.toRadians(south);
        }
        else 
        {
            var xTiles = this.getNumberOfXTilesAtLevel(level);
            var yTiles = this.getNumberOfYTilesAtLevel(level);
        
            var xTileWidth = rectangle.width / xTiles;
            west = x * xTileWidth + rectangle.west;
            east = (x + 1) * xTileWidth + rectangle.west;
        
            var yTileHeight = rectangle.height / yTiles;
            north = rectangle.north - y * yTileHeight;
            south = rectangle.north - (y + 1) * yTileHeight;
        }
        
        
        
        if (!defined(result)) {
            result = new Rectangle(west, south, east, north);
        }
        
        result.west = west;
        result.south = south;
        result.east = east;
        result.north = north;
        return result;
    };

    /**
     * Calculates the tile x, y coordinates of the tile containing
     * a given cartographic position.
     *
     * @param {Cartographic} position The position.
     * @param {Number} level The tile level-of-detail.  Zero is the least detailed.
     * @param {Cartesian2} [result] The instance to which to copy the result, or undefined if a new instance
     *        should be created.
     * @returns {Cartesian2} The specified 'result', or a new object containing the tile x, y coordinates
     *          if 'result' is undefined.
     */
    GeographicTilingScheme.prototype.positionToTileXY = function(position, level, result) {
        var rectangle = this._rectangle;
        if (!Rectangle.contains(rectangle, position)) {
            // outside the bounds of the tiling scheme
            return undefined;
        }

          if(defined(this._tileInfo))
            {
                var currentMatrix = this._tileInfo.lods.filter(function(item){
                    return item.level === level;
                });
                var currentResolution = currentMatrix[0].resolution;
                
                var degLon = CesiumMath.toDegrees(position.longitude);
                var degLat = CesiumMath.toDegrees(position.latitude);
         
                var x_4490 = Math.floor( (degLon - this._tileInfo.origin.x) / (this._tileInfo.rows * currentResolution) );
                var y_4490 = Math.floor( (this._tileInfo.origin.y - degLat) / (this._tileInfo.cols * currentResolution) );
         
                return new Cartesian2(x_4490, y_4490);
            }

        var xTiles = this.getNumberOfXTilesAtLevel(level);
        var yTiles = this.getNumberOfYTilesAtLevel(level);

        var xTileWidth = rectangle.width / xTiles;
        var yTileHeight = rectangle.height / yTiles;

        var longitude = position.longitude;
        if (rectangle.east < rectangle.west) {
            longitude += CesiumMath.TWO_PI;
        }

        var xTileCoordinate = (longitude - rectangle.west) / xTileWidth | 0;
        if (xTileCoordinate >= xTiles) {
            xTileCoordinate = xTiles - 1;
        }

        var yTileCoordinate = (rectangle.north - position.latitude) / yTileHeight | 0;
        if (yTileCoordinate >= yTiles) {
            yTileCoordinate = yTiles - 1;
        }

        if (!defined(result)) {
            return new Cartesian2(xTileCoordinate, yTileCoordinate);
        }

        result.x = xTileCoordinate;
        result.y = yTileCoordinate;
        return result;
    };

    return GeographicTilingScheme;
});

3.修改Ellipsoid.js
定義一個(gè)新的坐標(biāo)系

Ellipsoid.CGCS2000 = Object.freeze(new Ellipsoid(6378137.0, 6378137.0, 6356752.31414035585));
image.png

4.編譯cesium

因?yàn)檫@個(gè)示例的不支持跨域练般,所以考慮用vue設(shè)置了轉(zhuǎn)發(fā)


image.png
image.png
結(jié)果

參考文章:
https://blog.csdn.net/yanasdf789/article/details/109103514

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末矗漾,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子薄料,更是在濱河造成了極大的恐慌敞贡,老刑警劉巖,帶你破解...
    沈念sama閱讀 206,723評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件摄职,死亡現(xiàn)場離奇詭異誊役,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)谷市,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,485評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門势木,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人歌懒,你說我怎么就攤上這事∷莺” “怎么了及皂?”我有些...
    開封第一講書人閱讀 152,998評(píng)論 0 344
  • 文/不壞的土叔 我叫張陵甫男,是天一觀的道長。 經(jīng)常有香客問我验烧,道長板驳,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,323評(píng)論 1 279
  • 正文 為了忘掉前任碍拆,我火速辦了婚禮若治,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘感混。我一直安慰自己端幼,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,355評(píng)論 5 374
  • 文/花漫 我一把揭開白布弧满。 她就那樣靜靜地躺著婆跑,像睡著了一般。 火紅的嫁衣襯著肌膚如雪庭呜。 梳的紋絲不亂的頭發(fā)上滑进,一...
    開封第一講書人閱讀 49,079評(píng)論 1 285
  • 那天,我揣著相機(jī)與錄音募谎,去河邊找鬼扶关。 笑死,一個(gè)胖子當(dāng)著我的面吹牛数冬,可吹牛的內(nèi)容都是我干的节槐。 我是一名探鬼主播,決...
    沈念sama閱讀 38,389評(píng)論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼吉执,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼疯淫!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起戳玫,我...
    開封第一講書人閱讀 37,019評(píng)論 0 259
  • 序言:老撾萬榮一對(duì)情侶失蹤熙掺,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后咕宿,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體币绩,經(jīng)...
    沈念sama閱讀 43,519評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,971評(píng)論 2 325
  • 正文 我和宋清朗相戀三年府阀,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了缆镣。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,100評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡试浙,死狀恐怖董瞻,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤钠糊,帶...
    沈念sama閱讀 33,738評(píng)論 4 324
  • 正文 年R本政府宣布挟秤,位于F島的核電站,受9級(jí)特大地震影響抄伍,放射性物質(zhì)發(fā)生泄漏艘刚。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,293評(píng)論 3 307
  • 文/蒙蒙 一截珍、第九天 我趴在偏房一處隱蔽的房頂上張望攀甚。 院中可真熱鬧,春花似錦岗喉、人聲如沸秋度。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,289評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽静陈。三九已至,卻和暖如春诞丽,著一層夾襖步出監(jiān)牢的瞬間鲸拥,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,517評(píng)論 1 262
  • 我被黑心中介騙來泰國打工僧免, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留刑赶,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 45,547評(píng)論 2 354
  • 正文 我出身青樓懂衩,卻偏偏與公主長得像撞叨,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子浊洞,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,834評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容

  • iOS面試題目100道 1.線程和進(jìn)程的區(qū)別牵敷。 進(jìn)程是系統(tǒng)進(jìn)行資源分配和調(diào)度的一個(gè)獨(dú)立單位,線程是進(jìn)程的一個(gè)實(shí)體法希,...
    有度YouDo閱讀 29,874評(píng)論 8 137
  • 本文簡單介紹python語言的地圖可視化庫Folium Folium地址:https://github.com/p...
    賬號(hào)已刪除閱讀 26,214評(píng)論 10 76
  • 久違的晴天枷餐,家長會(huì)。 家長大會(huì)開好到教室時(shí)苫亦,離放學(xué)已經(jīng)沒多少時(shí)間了毛肋。班主任說已經(jīng)安排了三個(gè)家長分享經(jīng)驗(yàn)。 放學(xué)鈴聲...
    飄雪兒5閱讀 7,495評(píng)論 16 22
  • 今天感恩節(jié)哎屋剑,感謝一直在我身邊的親朋好友润匙。感恩相遇!感恩不離不棄唉匾。 中午開了第一次的黨會(huì)孕讳,身份的轉(zhuǎn)變要...
    迷月閃星情閱讀 10,551評(píng)論 0 11
  • 可愛進(jìn)取,孤獨(dú)成精。努力飛翔厂财,天堂翱翔油啤。戰(zhàn)爭美好,孤獨(dú)進(jìn)取蟀苛。膽大飛翔,成就輝煌逮诲。努力進(jìn)取帜平,遙望,和諧家園梅鹦●伤Γ可愛游走...
    趙原野閱讀 2,716評(píng)論 1 1