Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add tianditu layer to sceneView? #15

Open
devilsbibble opened this issue Dec 29, 2018 · 2 comments
Open

How to add tianditu layer to sceneView? #15

devilsbibble opened this issue Dec 29, 2018 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@devilsbibble
Copy link

  • js 4.10

  • WebTileLayer.createSubclass

  • code:
    let TiandituWMTSLayer = WebTileLayer.createSubclass({
    declaredClass: "TiandituWMTSLayer",
    getDefaults:function (b) {
    var sp = new SpatialReference({
    "wkid": 4326
    });
    var c = new Extent(-180, -90, 180, 90, sp);
    return{
    fullExtent: c,
    tileInfo: new TileInfo({
    rows: 256,
    cols: 256,
    dpi: 300,
    format: "PNG32",
    compressionQuality: 0,
    origin: new Point({x: -180, y: 90, spatialReference: sp}),
    spatialReference: sp,
    lods: [
    new LOD({level: 1, resolution: 0.703125, scale: 295497593.05875003}),
    new LOD({level: 2, resolution: 0.3515625, scale: 147748796.52937502}),
    new LOD({level: 3, resolution: 0.17578125, scale: 73874398.264687508}),
    new LOD({level: 4, resolution: 0.087890625, scale: 36937199.132343754}),
    new LOD({level: 5, resolution: 0.0439453125, scale: 18468599.566171877}),
    new LOD({level: 6, resolution: 0.02197265625, scale: 9234299.7830859385}),
    new LOD({level: 7, resolution: 0.010986328125, scale: 4617149.8915429693}),
    new LOD({level: 8, resolution: 0.0054931640625, scale: 2308574.9457714846}),
    new LOD({level: 9, resolution: 0.00274658203125, scale: 1154287.4728857423}),
    new LOD({level: 10, resolution: 0.001373291015625, scale: 577143.73644287116}),
    new LOD({level: 11, resolution: 0.0006866455078125, scale: 288571.86822143558}),
    new LOD({level: 12, resolution: 0.00034332275390625, scale: 144285.93411071779}),
    new LOD({level: 13, resolution: 0.000171661376953125, scale: 72142.967055358895}),
    new LOD({level: 14, resolution: 8.58306884765625e-005, scale: 36071.483527679447}),
    new LOD({level: 15, resolution: 4.291534423828125e-005, scale: 18035.741763839724}),
    new LOD({level: 16, resolution: 2.1457672119140625e-005, scale: 9017.8708819198619}),
    new LOD({level: 17, resolution: 1.0728836059570313e-005, scale: 4508.9354409599309}),
    new LOD({level: 18, resolution: 5.3644180297851563e-006, scale: 2254.4677204799655}),
    new LOD({level: 19, resolution: 2.6822090148925781e-006, scale: 1127.2338602399827}),
    new LOD({level: 20, resolution: 1.3411045074462891e-006, scale: 563.61693011999137})
    ]
    })
    }
    },
    getTileUrl(level, row, col) {
    let url = 'http://t' + col % 8 + '.tianditu.cn/' + this.wmtslayer + '_c/wmts?' +
    'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=' + this.wmtslayer +
    '&STYLE=default&TILEMATRIXSET=c&TILEMATRIX=' +
    level + '&TILEROW=' + row + '&TILECOL=' + col + '&FORMAT=tiles';
    return url;
    }
    });
    var options1 = {
    id: "tianDiTu_img",
    visible: true,
    wmtslayer: "img",
    layerType:'img',
    "urlTemplate": "not null",
    };
    var layer2 = new TiandituWMTSLayer(options1);
    var view3d = new SceneView({
    map: map,
    center: [110.1, 23.8],
    zoom: 2,
    spatialReference: {
    wkid: 102100
    },
    container: "mapDiv3D"
    });

  • error:
    message: "The tiling scheme of this layer is not supported by SceneView"
    name: "layerview:tiling-scheme-unsupported"

@devilsbibble
Copy link
Author

Therer is a sample,include tianditu layer,sample

@mvdbster
Copy link
Collaborator

mvdbster commented Feb 8, 2019

@lisastaehli should we also add the WebTileLayer type to the layer loader?

@mvdbster mvdbster added the enhancement New feature or request label Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants