arcgis js 3.x加载arcgis server发布的离线静态切片问题

1.遇到的问题  

用arcgis js 3.x加载arcgis server发布的离线静态切片无法看到地图,分析其是找不到对应的行列号,决定行列号大小的因素无疑就是分辨率、切片大小、切片原点坐标,所以问题的重点是关注原点,调整原点坐标来测试;

最终改了原点坐标x和y,地图能正常显示了。

define(["dojo/_base/declare",
    "esri/layers/TiledMapServiceLayer",
    "esri/SpatialReference",
    "esri/geometry/Point",
    "esri/geometry/Extent",
    "esri/layers/TileInfo"], function (declare, TiledMapServiceLayer, SpatialReference, Point,Extent, TileInfo) {
    return declare('agsTileLayer', TiledMapServiceLayer, {

        constructor: function (baseUrl) {
            this.url = baseUrl;       
            this.spatialReference = new SpatialReference(4547);
            this.fullExtent = new Extent(
                -5123012.4729120005, -10001964.729228035, 6123012.4729120005, 10001964.729228035, this.spatialReference);
            this.initialExtent = this.fullExtent = new Extent(
                -5123012.4729120005, -10001964.729228035, 6123012.4729120005, 10001964.729228035, this.spatialReference);
            this.y = 11002161.202150838 - 132.29193125052919 * 256 * 76;
            this.x = -5685313.720203201 + 132.29193125052919 * 256 * 1;
            this.tileInfo = new TileInfo({
                "rows": 512,
                "cols": 512,
                "format": "png",
                "dpi":96,
                "compressionQuality": 0,
                "isWrappable": false,
               // "origin": { "x": -5685313.720203201, "y": 11002161.202150838 },
                "origin": new Point(this.x, this.y, this.spatialReference),

                "spatialReference": new esri.SpatialReference(4547),
                "lods": [
                    { "level": 0, "scale": 500000, "resolution": 132.29193125052919 },
                    { "level": 1, "scale": 250000, "resolution": 66.145965625264594 },
                    { "level": 2, "scale": 125000, "resolution": 33.072982812632297 },
                    { "level": 3, "scale": 64000, "resolution": 16.933367200067735 },
                    { "level": 4, "scale": 32000, "resolution": 8.4666836000338677 },
                    { "level": 5, "scale": 16000, "resolution": 4.2333418000169338 },
                    { "level": 6, "scale": 8000, "resolution": 2.1166709000084669 },
                    { "level": 7, "scale": 4000, "resolution": 1.0583354500042335 },
                    { "level": 8, "scale": 2000, "resolution": 0.52916772500211673 },
                    { "level": 9, "scale": 1000, "resolution": 0.26458386250105836 },
                    { "level": 10, "scale": 500, "resolution": 0.13229193125052918 }]
            
            });
            this.loaded = true;
            this.onLoad(this);
        },

        getTileUrl: function (level, row, col) {
           ///***这块推理很难***/
           // if (level <= 2) {
           //     row = row - 38 * Math.pow(2, level);
           // }
           // if (level >= 3) {
           //     row = row - 298 * Math.pow(2, level-3);
           // }
           // /***这块推理很难***/
           
            console.log(level, row, col)
           
            return  "http://localhost:8090/Layers/_alllayers/" +
                "L" + dojo.string.pad(level, 2, '0') + "/" +
                "R" + dojo.string.pad(row.toString(16), 8, '0') + "/" +
                "C" + dojo.string.pad(col.toString(16), 8, '0') + "." +
                "png";
            
        }
    });
});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值