精华内容
下载资源
问答
  • wmts

    2018-11-29 18:54:35
    /* 获取外层的父级元素 */ var capabilities = $(res).find("Capabilities").eq(0); /* 获取服务信息部分 */ var serviceIdentification =$(res).find("ows\\:ServiceIdentification"...
    /* 获取外层的父级元素 */
    var capabilities = $(res).find("Capabilities").eq(0);
    /* 获取服务信息部分 */
    var serviceIdentification =$(res).find("ows\\:ServiceIdentification");
    /* 获取Content层 */
    var content = $(res).find("Contents").eq(0);
    /* 获取Layer层 */
    var layer=content.find("Layer").eq(0);
    /* 获取TileMatrixSet层 */
    var tileMatrixSet=content.children("TileMatrixSet").eq(0);
    /* 获取服务crs内的坐标系 */
    var serviceCrs=layer.find("ows\\:WGS84BoundingBox").attr("crs");
    /* 获取图层crs内的坐标系 */
    var layoutCrs=tileMatrixSet.find("ows\\:SupportedCRS").eq(0).text();
    /* 获取图层范围信息 */
    var boundingBox = layer.find("ows\\:WGS84BoundingBox").eq(0);
    /* 最小经度、纬度 */
    var smallZhi=boundingBox.find("ows\\:LowerCorner").eq(0).text();
    /* 最大经度、纬度 */
    var bigZhi=boundingBox.find("ows\\:UpperCorner").eq(0).text();
    var smallRange=smallZhi.split(" ");
    var bigRange=bigZhi.split(" ");
    /* 设置版本号 */
    var versionHao = serviceIdentification.find("ows\\:ServiceTypeVersion").eq(0).text();
    /* 设置瓦片格式 */
    var wapian=layer.find("Format").eq(0).text();
    // 图层坐标系
    $(".coordinateLay").text(getCrs(layoutCrs));
    /* 设置图层范围 */
    $(".leftJing").text(smallRange[0]);
    $(".leftWei").text(bigRange[1]);

     

    展开全文
  • WMTS加载

    2020-08-12 16:24:16
    使用arcgis js api 加载wmts代码 直接访问http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china可以直接查看wmts的GetCapabilities内容。等同于...

    使用arcgis js api 加载wmts代码

    直接访问http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china 可以直接查看wmts的GetCapabilities内容。等同于http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china?SERVICE=WMTS&request=GetCapabilities

    ResourceURl 可以通过http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china/China/default/ChinaPublicServices_China/9/150/849.png进行访问。实际在web中查看network访问的地址是通过wmts的

    GetTile进行访问的:

    http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=China&STYLE=default&FORMAT=image/png&TILEMATRIXSET=ChinaPublicServices_China&TILEMATRIX=9&TILEROW=150&TILECOL=849

    在JS代码中TileInfo的rows和cols应该是对应TileMatrix的TileWidth和TileHeight。如果修改该值,虽然也可以显示,但是会出现图片显示有问题,位置不对。超图中TileInfo中LODS是标准<WellKnownScaleSet>ChinaPublicServices</WellKnownScaleSet>,天地图http://t0.tianditu.gov.cn/img_w/wmts?request=GetCapabilities&service=wmts&tk=41992f255f5c4efffceb41e0f06d3dc2也是采用这个切图比例。但是其它省的发布的服务不一定是采用这个比例的(天地图官网可以查询其它地图服务),比如浙江(也不需要申请key)。天地图每个种类的地图都有两种切图,一种是经纬度,一个是墨卡托。

    http://srv.zjditu.cn/ZJEMAP_2D/wmts?request=GetCapabilities&service=wmts

    • 加载esr的WMTS服务

    https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=SRTM_Color_Index&STYLE=default&FORMAT=image/png&TILEMATRIXSET=31.25m&TILEMATRIX=3&TILEROW=2&TILECOL=7

    可以通过上面访问具体某个图片,但是https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/?SERVICE=WMTS&request=GetCapabilities访问不到元数据信息,如何获取?还是该服务并没有提供此功能?

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
        <title>Map with WMTS resourceinfo</title>
    
        <link rel="stylesheet" href="https://js.arcgis.com/3.33/dijit/themes/claro/claro.css">
        <link rel="stylesheet" href="https://js.arcgis.com/3.33/esri/css/esri.css">
        <style>
            html,
            body,
            #map {
                height: 100%;
                width: 100%;
                margin: 0;
                padding: 0;
            }
        </style>
        <script src="https://js.arcgis.com/3.33/"></script>
    
        <script>
            require([
                "esri/map",
                "esri/layers/WMTSLayer",
                "esri/layers/WMTSLayerInfo",
                "esri/geometry/Extent",
                "esri/layers/TileInfo",
                "esri/SpatialReference",
                "dojo/parser",
                "dijit/layout/BorderContainer",
                "dijit/layout/ContentPane",
                "dojo/domReady!"
            ], function(
                Map, WMTSLayer, WMTSLayerInfo,
                Extent, TileInfo, SpatialReference,
                parser
            ) {
                parser.parse();
    
                var map = new Map("map", {
                    center: [86.9, 28],
                    zoom: 3
                });
    
                var tileInfo = new TileInfo({
                    "dpi": 96,
                    "format": "format/png",
                    "compressionQuality": 0,
                    "spatialReference": new SpatialReference({
                        "wkid": 4326
                    }),
                    "rows": 512,
                    "cols": 512,
                    "origin": {
                        "x": -180,
                        "y": 90
                    },
                    "lods": [{
                        "level": "0",
                        "scale": 236663484.36365247,
                        "resolution": 0.5624999999999999
                    }, {
                        "level": "1",
                        "scale": 118331742.18182631,
                        "resolution": 0.28125000000000017
                    }, {
                        "level": "2",
                        "scale": 59165871.090913124,
                        "resolution": 0.140625
                    }, {
                        "level": "3",
                        "scale": 29582935.545456562,
                        "resolution": 0.0703125
                    }, {
                        "level": "4",
                        "scale": 14791467.772728289,
                        "resolution": 0.03515625000000002
                    }, {
                        "level": "5",
                        "scale": 395733.8863641415,
                        "resolution": 0.017578125000000003
                    }, {
                        "level": "6",
                        "scale": 3697866.94318207,
                        "resolution": 0.008789062499999998
                    }, {
                        "level": "7",
                        "scale": 1848933.471591035,
                        "resolution": 0.004394531249999999
                    }, {
                        "level": "8",
                        "scale": 924466.7357955176,
                        "resolution": 0.002197265625
                    }, {
                        "level": "9",
                        "scale": 462233.3678977588,
                        "resolution": 0.0010986328125
                    }, {
                        "level": "10",
                        "scale": 231116.6839488794,
                        "resolution": 0.00054931640625
                    }, {
                        "level": "11",
                        "scale": 115558.3419744397,
                        "resolution": 0.000274658203125
                    }]
                });
                var tileExtent = new Extent(-180, -90, 180, 90, new SpatialReference({
                    wkid: 4326
                }));
    
                var layerInfo = new WMTSLayerInfo({
                    tileInfo: tileInfo,
                    fullExtent: tileExtent,
                    initialExtent: tileExtent,
                    identifier: "SRTM_Color_Index",
                    tileMatrixSet: "31.25m",
                    format: "png",
                    style: "default"
                });
    
                var resourceInfo = {
                    version: "1.0.0",
                    layerInfos: [layerInfo],
                    copyright: "earthdata"
                };
    
                var options = {
                    serviceMode: "KVP",
                    resourceInfo: resourceInfo,
                    layerInfo: layerInfo
                };
    
                wmtsLayer = new WMTSLayer("https://gibs.earthdata.nasa.gov/wmts/epsg4326/best", options);
                map.addLayer(wmtsLayer);
            });
        </script>
    </head>
    
    <body>
    <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width: 100%; height: 100%; margin: 0;">
    
        <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
            <div id="citationInfo">
                <a href="https://earthdata.nasa.gov">Earthdata</a>
                served by
                <a href="https://www.nasa.gov">NASA</a>
            </div>
        </div>
    
    </div>
    </body>
    
    </html>
    • 加载supermap发布的wmts服务
    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
        <title>WMTS地图服务</title>
        <link rel="stylesheet" href="https://js.arcgis.com/3.33/dijit/themes/claro/claro.css">
        <link rel="stylesheet" href="https://js.arcgis.com/3.33/esri/css/esri.css">
        <script src="https://js.arcgis.com/3.33/"></script>
    
        <style>
            html,
            body,
            #map {
                height: 100%;
                width: 100%;
                margin: 0;
                padding: 0;
            }
        </style>
    
        <script>
            require([
                "esri/map",
                "esri/layers/WMTSLayer",
                "esri/layers/WMTSLayerInfo",
                "esri/geometry/Extent",
                "esri/layers/TileInfo",
                "esri/SpatialReference",
                "dojo/domReady!"
            ], function (
                Map,
                WMTSLayer,
                WMTSLayerInfo,
                Extent,
                TileInfo,
                SpatialReference,
                parser
            ) {
                var map = new Map("map", {
                    center: [117,36.651],
                    zoom: 8
                });
    
                var tileInfo = new TileInfo({
                    "dpi": 96,
                    "format": "image/png",
                    "compressionQuality": 0,
                    "spatialReference": new SpatialReference({
                        "wkid": 4326
                    }),
                    "rows": 256,
                    "cols": 256,
                    "origin": {
                        "x": -180,
                        "y": 90
                    },
                    "lods": [
                        {"level": "0","scale": 295829355.45,"resolution": 0.703125},
                        {"level": "1","scale": 147914677.725,"resolution": 0.3515625},
                        {"level": "2", "scale": 73957338.8625,"resolution": 0.17578125},
                        {"level": "3","scale": 36978669.43125,"resolution": 0.087890625},
                        {"level": "4","scale": 18489334.715625,"resolution": 0.0439453125},
                        {"level": "5","scale": 9244667.3578125,"resolution": 0.02197265625},
                        {"level": "6","scale": 4622333.67890625,"resolution": 0.010986328125},
                        {"level": "7","scale": 2311166.83945312,"resolution": 0.0054931640625},
                        {"level": "8","scale": 1155583.41972656,"resolution": 0.00274658203125},
                        {"level": "9","scale": 577791.709863281,"resolution": 0.001373291015625},
                        {"level": "10","scale": 288895.8549316406,"resolution": 0.0006866455078125},
                        {"level": "11","scale": 144447.9274658203,"resolution": 0.00034332275390625},
                        {"level": "12","scale": 4508.935440959931,"resolution": 0.000171661376953125},
                        {"level": "13","scale": 36111.98186645508,"resolution": 0.0000858306884765625},
                        {"level": "14","scale": 18055.99093322754,"resolution": 0.0000429153442382812},
                        {"level": "15","scale": 9027.99546661377,"resolution": 0.0000214576721191406},
                        {"level": "16","scale": 4513.997733306885,"resolution": 0.0000107288360595703},
                        {"level": "17","scale": 2256.9988666534423,"resolution": 0.00000536441802978515},
                        {"level": "18","scale": 1128.4994333267211,"resolution": 0.00000268220901489257},
                        {"level": "19","scale": 564.2497166633606,"resolution": 0.00000134110450744628}
                    ]
                });
                var tileExtent = new Extent(-180.0 , -85.0511287798065,180.0 , 85.05112877980648, new SpatialReference({
                    wkid: 4326
                }));
    
                var layerInfo = new WMTSLayerInfo({
                    tileInfo: tileInfo,
                    fullExtent: tileExtent,
                    initialExtent: tileExtent,
                    identifier: "China",
                    tileMatrixSet: "ChinaPublicServices_China",
                    format: "png",
                    style: "default"
                });
    
                var resourceInfo = {
                    version: "1.0.0",
                    layerInfos: [layerInfo],
                    copyright: ""
                };
                var options = {
                    serviceMode: "KVP",
                    resourceInfo: resourceInfo,
                    layerInfo: layerInfo
                };
                var wmtsLayer = new WMTSLayer("http://www.supermap.com.cn:8090/iserver/services/map-china400/wmts-china", options);
                map.addLayer(wmtsLayer);
            });
        </script>
    </head>
    <body>
    <div id="map"></div>
    </body>
    </html>
    • ArcMap加载天地图,因为需要tk,所以和其他的有所不同,(参数需要如下添加使用服务端tk)但是添加img_w平面的就无法显示?

    添加之后拖动到地图窗口就可以显示

    js加载 使用申请的浏览器的tk

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
        <title>天地图影像(经纬度) - 4.x</title>
    
        <!-- 用4.12的api会报错  -->
        <link rel="stylesheet" href="https://js.arcgis.com/4.10/esri/css/main.css"/>
        <script src="https://js.arcgis.com/4.10/"></script>
    
        <style>
            html,
            body,
            #viewDiv {
                padding: 0;
                margin: 0;
                height: 100%;
                width: 100%;
            }
        </style>
    
        <script>
            require([
                "esri/Map",
                "esri/layers/WebTileLayer",
                'esri/layers/support/TileInfo',
                'esri/views/MapView',
                'dojo/domReady!'
            ], function (Map, WebTileLayer, TileInfo, MapView) {
                var tiandituBaseUrl = "http://{subDomain}.tianditu.com"; //天地图服务地址
                var token = "41992f255f5c4efffceb41e0f06d3dc2"; //天地图token
    
                // 首先设定瓦片信息,天地图经纬度地图的切片信息全部使用该信息设定
                var tileInfo = new TileInfo({
                    dpi: 90.71428571427429,
                    rows: 256,
                    cols: 256,
                    compressionQuality: 0,
                    origin: {
                        x: -180,
                        y: 90
                    },
                    spatialReference: {
                        wkid: 4326
                    },
                    lods: [
                        {level: 2, levelValue: 2, resolution: 0.3515625, scale: 147748796.52937502},
                        {level: 3, levelValue: 3, resolution: 0.17578125, scale: 73874398.264687508},
                        {level: 4, levelValue: 4, resolution: 0.087890625, scale: 36937199.132343754},
                        {level: 5, levelValue: 5, resolution: 0.0439453125, scale: 18468599.566171877},
                        {level: 6, levelValue: 6, resolution: 0.02197265625, scale: 9234299.7830859385},
                        {level: 7, levelValue: 7, resolution: 0.010986328125, scale: 4617149.8915429693},
                        {level: 8, levelValue: 8, resolution: 0.0054931640625, scale: 2308574.9457714846},
                        {level: 9, levelValue: 9, resolution: 0.00274658203125, scale: 1154287.4728857423},
                        {level: 10, levelValue: 10, resolution: 0.001373291015625, scale: 577143.73644287116},
                        {level: 11, levelValue: 11, resolution: 0.0006866455078125, scale: 288571.86822143558},
                        {level: 12, levelValue: 12, resolution: 0.00034332275390625, scale: 144285.93411071779},
                        {level: 13, levelValue: 13, resolution: 0.000171661376953125, scale: 72142.967055358895},
                        {level: 14, levelValue: 14, resolution: 8.58306884765625e-005, scale: 36071.483527679447},
                        {level: 15, levelValue: 15, resolution: 4.291534423828125e-005, scale: 18035.741763839724},
                        {level: 16, levelValue: 16, resolution: 2.1457672119140625e-005, scale: 9017.8708819198619},
                        {level: 17, levelValue: 17, resolution: 1.0728836059570313e-005, scale: 4508.9354409599309},
                        {level: 18, levelValue: 18, resolution: 5.3644180297851563e-006, scale: 2254.4677204799655},
                        {level: 19, levelValue: 19, resolution: 2.68220901489257815e-006, scale: 1127.23386023998275},
                        {level: 20, levelValue: 2, resolution: 1.341104507446289075e-006, scale: 563.616930119991375}
                    ]
                })
    
                //地图(经纬度)
                var tiledLayer = new WebTileLayer({
                    urlTemplate: tiandituBaseUrl + "/DataServer?T=img_c&x={col}&y={row}&l={level}&tk=" + token,
                    subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
                    tileInfo: tileInfo
                });
    
                //注记(经纬度)
                var tiledLayerAnno = new WebTileLayer({
                    urlTemplate: tiandituBaseUrl + "/DataServer?T=cia_c&x={col}&y={row}&l={level}&tk=" + token,
                    subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
                    tileInfo: tileInfo
                });
    
                // 创建地图,不设置底图,如果设置底图会造成坐标系无法被转换成 ESPG:4326 (WGS1984)
                var map = new Map({
                    spatialReference: {
                        wkid: 4326
                    },
                    basemap: {
                        baseLayers: [tiledLayer, tiledLayerAnno]
                    }
                });
    
                var view = new MapView({
                    container: "viewDiv",
                    spatialReference: {
                        wkid: 4326
                    },
                    map: map,
                    center: [108.953098279, 34.2777998978],
                    //1:scale的图
                    scale: 2000000
                });
    
            });
        </script>
    </head>
    
    <body>
    <div id="viewDiv"></div>
    </body>
    </html>

    对于3.x的js api可以使用扩展TiledMapServiceLayer方式,注意网上代码url地址最新t1.tianditu.gov.cn

    define(["dojo/_base/declare",
            "esri/layers/tiled"],
        function (declare) {
            return declare(esri.layers.TiledMapServiceLayer, {
                constructor: function () {
                    this.spatialReference = new esri.SpatialReference({ wkid: 4326 });
                    this.initialExtent = (this.fullExtent = new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference));
                    this.tileInfo = new esri.layers.TileInfo({
                        "rows": 256,
                        "cols": 256,
                        "compressionQuality": 0,
                        "origin": {
                            "x": -180,
                            "y": 90
                        },
                        "spatialReference": {
                            "wkid": 4326
                        },
                        "lods": [
                            { "level": 2, "resolution": 0.3515625, "scale": 147748796.52937502 },
                            { "level": 3, "resolution": 0.17578125, "scale": 73874398.264687508 },
                            { "level": 4, "resolution": 0.087890625, "scale": 36937199.132343754 },
                            { "level": 5, "resolution": 0.0439453125, "scale": 18468599.566171877 },
                            { "level": 6, "resolution": 0.02197265625, "scale": 9234299.7830859385 },
                            { "level": 7, "resolution": 0.010986328125, "scale": 4617149.8915429693 },
                            { "level": 8, "resolution": 0.0054931640625, "scale": 2308574.9457714846 },
                            { "level": 9, "resolution": 0.00274658203125, "scale": 1154287.4728857423 },
                            { "level": 10, "resolution": 0.001373291015625, "scale": 577143.73644287116 },
                            { "level": 11, "resolution": 0.0006866455078125, "scale": 288571.86822143558 },
                            { "level": 12, "resolution": 0.00034332275390625, "scale": 144285.93411071779 },
                            { "level": 13, "resolution": 0.000171661376953125, "scale": 72142.967055358895 },
                            { "level": 14, "resolution": 8.58306884765625e-005, "scale": 36071.483527679447 },
                            { "level": 15, "resolution": 4.291534423828125e-005, "scale": 18035.741763839724 },
                            { "level": 16, "resolution": 2.1457672119140625e-005, "scale": 9017.8708819198619 },
                            { "level": 17, "resolution": 1.0728836059570313e-005, "scale": 4508.9354409599309 },
                            { "level": 18, "resolution": 5.3644180297851563e-006, "scale": 2254.4677204799655 }
                        ]
                    });
                    this.loaded = true;
                    this.onLoad(this);
                },
                getTileUrl: function (level, row, col) {
                    return "http://t1.tianditu.gov.cn/vec_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX=" + level + "&TILEROW=" + row + "&TILECOL=" + col + "&FORMAT=tiles&tk=41992f255f5c4efffceb41e0f06d3dc2";
                }
            });
        });
    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>TianDi Map</title>
        <link rel="stylesheet" href="https://js.arcgis.com/3.26/esri/css/esri.css">
        <style>
            html, body, #map {
                height: 100%;
                margin: 0;
                padding: 0;
            }
        </style>
        <script type="text/javascript">
            dojoConfig = {
                parseOnLoad: true,
                packages: [{
                    name: 'bdlib',
                    location: this.location.pathname.replace(/\/[^/]+$/, "")+"/js/bdlib"
                }]
            };
        </script>
        <script src="https://js.arcgis.com/3.26/"></script>
        <script>
            var map;
            require(["esri/map",
                    "bdlib/TDTLayer",
                    "esri/layers/FeatureLayer",
                    "esri/geometry/Point",
                    "esri/symbols/SimpleFillSymbol",
                    "esri/symbols/SimpleLineSymbol",
                    "dojo/_base/Color",
                    "dojo/domReady!"],
                function (Map,
                          TDTLayer,
                          FeatureLayer,
                          Point,
                          SimpleFillSymbol,
                          SimpleLineSymbol,
                          Color
                ){
                    map = new Map("map", { logo: false });
                    var basemap = new TDTLayer();
                    map.addLayer(basemap);
                    var pt = new Point(103.847, 36.0473);
                    map.centerAndZoom(pt, 3);
                });
        </script>
    </head>
    <body>
    <div id="map"></div>
    </body>
    </html>

    目录结构如下:

    注意上面天地图使用的是经纬度的,如果是墨卡托地图只是修改了url地址这样虽然可以显示地图,但是经纬度定位是不对的。

     http://www.supermap.com.cn:8090/iserver/services    超图官方的IServer

     

    另外使用js3.x版本使用WMTSLayer加载天地图,(ArcGIS源码会给WMTSLayer的format字段自动加上“image/”,而天地图支持的格式“tiles”不接受format=image/png这样的参数)。可以参考https://blog.csdn.net/OldMonkeyYu_s/article/details/53710779?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
        <title>test</title>
    
        <style>
            html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
            #map { padding:0; }
            #citationInfo { position:absolute; color:black; font-weight:bold; font-size:12pt; left:10px; bottom:10px; z-Index:999; }
        </style>
        <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
    
        <script type="text/javascript" src="https://js.arcgis.com/3.18compact/"></script>
        <script type="text/javascript" src="WMTSLayer.js"></script>
        <script>
            var map, wmtsLayer;
            require([
                "esri/map", "esri/layers/WMTSLayer", "esri/layers/WMTSLayerInfo",
                "esri/geometry/Extent", "esri/layers/TileInfo", "esri/SpatialReference",
                "dojo/parser",
    
                "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
            ], function (
                Map, WMTSLayer, WMTSLayerInfo,
                Extent, TileInfo, SpatialReference,
                parser
            ) {
                parser.parse();
    
                var bounds = new Extent({
                    "xmin": -128.816, "ymin": 25.076, "xmax": -72.855, "ymax": 51.385,
                    "spatialReference": { "wkid": 4326 }
                });
                map = new Map("map", {
                    extent: bounds
                });
    
                var tileInfo1 = new TileInfo({
                    "dpi": 96,
                    "format": "tiles",
                    "compressionQuality": 0,
                    "spatialReference": new SpatialReference({
                        "wkid": 4326
                    }),
                    "rows": 256,
                    "cols": 256,
                    "origin": {
                        "x": -180,
                        "y": 90
                    },
                    "lods": [{
                        "level": "1",
                        "scale": 295829355.455,
                        "resolution": 0.703914402554
                    }, {
                        "level": "2",
                        "scale": 147914677.727,
                        "resolution": 0.351957201277
                    }, {
                        "level": "3",
                        "scale": 73957338.8636,
                        "resolution": 0.175978600638
                    }, {
                        "level": "4",
                        "scale": 36978669.4318,
                        "resolution": 0.0879893003192
                    }, {
                        "level": "5",
                        "scale": 18489334.7159,
                        "resolution": 0.0439946501596
                    }, {
                        "level": "6",
                        "scale": 9244667.35796,
                        "resolution": 0.0219973250798
                    }, {
                        "level": "7",
                        "scale": 4622333.67898,
                        "resolution": 0.0109986625399
                    }, {
                        "level": "8",
                        "scale": 2311166.83949,
                        "resolution": 0.00549933126995
                    }, {
                        "level": "9",
                        "scale": 1155583.41974,
                        "resolution": 0.00274966563497
                    }, {
                        "level": "10",
                        "scale": 577791.709872,
                        "resolution": 0.00137483281749
                    }]
                });
                var tileExtent1 = new Extent(-179.99999, -89.99999, 179.99999, 89.99999, new SpatialReference({
                    wkid: 4326
                }));
                var layerInfo1 = new WMTSLayerInfo({
                    tileInfo: tileInfo1,
                    fullExtent: tileExtent1,
                    initialExtent: tileExtent1,
                    identifier: "vec",
                    tileMatrixSet: "c",
                    format: "png",
                    style: "default"
                });
    
                var resourceInfo = {
                    version: "1.0.0",
                    layerInfos: [layerInfo1],
                    copyright: "天地图"
                };
    
                var options = {
                    serviceMode: "KVP",
                    resourceInfo: resourceInfo,
                    //如果没有配置resourceinfo会通过getCapacities获取
                    layerInfo: layerInfo1,
                    //附加参数
                    customParameters:{tk:"41992f255f5c4efffceb41e0f06d3dc2"}
                };
    
                wmtsLayer = new WMTSLayer("http://t0.tianditu.gov.cn/vec_c/wmts", options);
                map.addLayer(wmtsLayer);
            });
    
        </script>
    </head>
    
    <body>
    <div data-dojo-type="dijit/layout/BorderContainer"
         data-dojo-props="design:'headline', gutters:false"
         style="width: 100%; height: 100%; margin: 0;">
    
        <div id="map"
             data-dojo-type="dijit/layout/ContentPane"
             data-dojo-props="region:'center'">
            <div id="citationInfo">
                <a href="http://v2.suite.opengeo.org/geoserver/gwc/service/wmts">WMTS</a>
                served by
                <a href="http://opengeo.org/">天地图</a>
            </div>
        </div>
    
    </div>
    </body>
    </html>

    还可以参考https://gitee.com/MrHuanLiu/TDTLib

    展开全文
  • WMTS 概述SuperMap iServer 提供了 WMTS(Web Map Tile Service,Web 地图瓦片服务)服务,该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMTS 实现规范。WMTS 是 OGC 提出的缓存技术标准,即...

    WMTS 概述

    SuperMap iServer 提供了 WMTS(Web Map Tile Service,Web 地图瓦片服务)服务,该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMTS 实现规范。

    WMTS 是 OGC 提出的缓存技术标准,即在服务器端缓存被切割成一定大小瓦片的地图,对客户端只提供这些预先定义好的单个瓦片的服务,将更多的数据处理操作如图层叠加等放在客户端,从而缓解 GIS 服务器端数据处理的压力,改善用户体验。

    WMTS 使用瓦片矩阵集(Tile matrix set)来表示切割后的地图,如图1所示。瓦片就是包含地理数据的矩形影像,一幅地图按一定的瓦片大小被切割成多个瓦片,形成瓦片矩阵,一个或多个瓦片矩阵即组成瓦片矩阵集。不同的瓦片矩阵具有不同的分辨率,每个瓦片矩阵由瓦片矩阵标识符(一般为瓦片矩阵的序号,分辨率最低的一层为第0层,依次向上排)进行标识。

    048d1d27e58a3cd8e2225bdec2e8aaf2.png

    图1 瓦片矩阵集

    如图2所示,每个瓦片矩阵具有:

    1) 自己的瓦片尺寸作为比例尺;

    2) 通过像素数来定义的每个瓦片的宽(TileWidth)和高(TileHeight),即瓦片的大小。SuperMap iServer 目前提供的瓦片大小是256*256个像素;

    3) 边界框的左上角坐标(TileMatrixminX,TileMatrixmaxY);

    4) 以瓦片为单位来定义的矩阵的宽(MatrixWidth)和高(MatrixHeight),如瓦片数。

    19f3ac1f9e74b5552aca80f187be306f.png

    图2 瓦片矩阵

    瓦片矩阵中的每个瓦片由瓦片的行(TileRow)列(TileCol)值进行标识,行列值分别从瓦片矩阵左上角点所在的瓦片开始算起,起始行列值是(0,0),依次向下向右增加,如图2所示。

    WMTS 服务器只提供有限种坐标系和有限种比例尺的服务,为了提高客户端和服务器的互操作能力,WMTS 提出通用比例尺集(Well-known scale set)的概念。通用比例尺集是 WMTS 服务器之间的一个协定,由一个公共的坐标参考系统和一组公共的比例尺集合组成。定义 Well-known scale set 仅仅是一个协议机制,对于互操作来说在技术上并不是必需的。

    SuperMap iServer 目前支持以下 WMTS 版本:

    SuperMap iServer 的WMTS服务支持发布以下坐标参考系,参见iServer OGC 服务支持发布的坐标参考系。

    SuperMap iServer 的WMTS服务所提供的瓦片数据是基于一定的比例尺集合来生成的,目前支持的通用比例尺集请参考 WellknownScale。

    SuperMap iServer WMTS服务基于的比例尺是通过如下公式来定义的:

    比例尺=1: 地面分辨率(a)*屏幕分辨率(pixel/inch)/0.0254(m/inch)

    其中,地面分辨率(a)是指一个像素所代表的实际地面距离,单位为米,屏幕分辨率(dpi)是指屏幕上每英寸长度内包含的像素数量,一般默认是96dpi,即每英寸内有96个像素,而0.0254(m/inch)是指米与英寸的单位转换。

    最终,此公式可以简写为:比例尺=0.0254/(a*dpi)。

    WMTS 1.0.0 服务节点TopLeftCorner说明

    WMTS服务中,TopLeftCorner是描述比例尺集(TileMatrixSet)的左上角坐标的字符序列,由坐标X和坐标Y组成。

    在地理坐标系中,经度在纬度之前的顺序是不符合国际惯例的。航空和海运部门通常期望纬度在经度之前,在紧急情况下,不同的坐标显示可能会导致不安全的因素。虽然没有标准明确规定纬度必须在经度之前,但是一般来说都会采用纬度在经度之前的顺序。

    iServer WMTS 服务中,地理坐标系的TopLeftCorner使用“Y X”的顺序;投影坐标系、自定义坐标系、平面坐标系的TopLeftCorner使用“X Y”的顺序。

    表1 常见坐标系的TopLeftCorner顺序

    坐标系

    4326

    3857

    4490

    (国家大地坐标系)

    EPSG:0

    (自定义坐标系)

    平面坐标系

    TopLeftCorner坐标顺序

    YX

    XY

    YX

    XY

    XY

    请参考:

    OGC(Open Geospatial Consortium,开放地理信息联盟)WMTS 相关规范,http://www.opengeospatial.org。

    注:本文档完成日期为 2013 年 05 月 08 日 ,如果此前的文档(包括电子文档和印刷文档)与本文档不相符合,请以本文档为准。若本文档更新,则以更新后的文档为准。

    展开全文
  • WMTS subdivision selection

    2020-12-26 16:03:51
    <div><p>WMTS is not displaying correctly in WorldWind and an error is being thrown. <p>Service: https://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/WMTS Layer: ...
  • WMTS 概述

    千次阅读 2017-10-27 15:08:44
    SuperMap iServer 提供了 WMTS(Web Map Tile Service,Web 地图瓦片服务)服务,该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMTS 实现规范。 WMTS 是 OGC 提出的缓存技术标准,...
    SuperMap iServer 提供了 WMTS(Web Map Tile Service,Web 地图瓦片服务)服务,该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMTS 实现规范。
    

    WMTS 是 OGC 提出的缓存技术标准,即在服务器端缓存被切割成一定大小瓦片的地图,对客户端只提供这些预先定义好的单个瓦片的服务,将更多的数据处理操作如图层叠加等放在客户端,从而缓解 GIS 服务器端数据处理的压力,改善用户体验。

    WMTS 使用瓦片矩阵集(Tile matrix set)来表示切割后的地图,如图1所示。瓦片就是包含地理数据的矩形影像,一幅地图按一定的瓦片大小被切割成多个瓦片,形成瓦片矩阵,一个或多个瓦片矩阵即组成瓦片矩阵集。不同的瓦片矩阵具有不同的分辨率,每个瓦片矩阵由瓦片矩阵标识符(一般为瓦片矩阵的序号,分辨率最低的一层为第0层,依次向上排)进行标识。

    wmts 服务概述

    图1 瓦片矩阵集

    如图2所示,每个瓦片矩阵具有:

    1) 自己的瓦片尺寸作为比例尺;

    2) 通过像素数来定义的每个瓦片的宽(TileWidth)和高(TileHeight),即瓦片的大小。SuperMap iServer 目前提供的瓦片大小是256*256个像素;

    3) 边界框的左上角坐标(TileMatrixminX,TileMatrixmaxY);

    4) 以瓦片为单位来定义的矩阵的宽(MatrixWidth)和高(MatrixHeight),如瓦片数。

    wmts 服务概述

    图2 瓦片矩阵

    瓦片矩阵中的每个瓦片由瓦片的行(TileRow)列(TileCol)值进行标识,行列值分别从瓦片矩阵左上角点所在的瓦片开始算起,起始行列值是(0,0),依次向下向右增加,如图2所示。

    WMTS 服务器只提供有限种坐标系和有限种比例尺的服务,为了提高客户端和服务器的互操作能力,WMTS 提出通用比例尺集(Well-known scale set)的概念。通用比例尺集是 WMTS 服务器之间的一个协定,由一个公共的坐标参考系统和一组公共的比例尺集合组成。定义 Well-known scale set 仅仅是一个协议机制,对于互操作来说在技术上并不是必需的。

    SuperMap iServer 目前支持以下 WMTS 版本:

    SuperMap iServer 的WMTS服务支持发布以下坐标参考系,参见iServer OGC 服务支持发布的坐标参考系

    SuperMap iServer 的WMTS服务所提供的瓦片数据是基于一定的比例尺集合来生成的,目前支持的通用比例尺集请参考 WellknownScale

    SuperMap iServer WMTS服务基于的比例尺是通过如下公式来定义的:

    比例尺=1: 地面分辨率(a)*屏幕分辨率(pixel/inch)/0.0254(m/inch)

    其中,地面分辨率(a)是指一个像素所代表的实际地面距离,单位为米,屏幕分辨率(dpi)是指屏幕上每英寸长度内包含的像素数量,一般默认是96dpi,即每英寸内有96个像素,而0.0254(m/inch)是指米与英寸的单位转换。

    最终,此公式可以简写为:比例尺=0.0254/(a*dpi)

    • WMTS 1.0.0 服务节点TopLeftCorner说明

    WMTS服务中,TopLeftCorner是描述比例尺集(TileMatrixSet)的左上角坐标的字符序列,由坐标X和坐标Y组成。

    在地理坐标系中,经度在纬度之前的顺序是不符合国际惯例的。航空和海运部门通常期望纬度在经度之前,在紧急情况下,不同的坐标显示可能会导致不安全的因素。虽然没有标准明确规定纬度必须在经度之前,但是一般来说都会采用纬度在经度之前的顺序。

    iServer WMTS 服务中,地理坐标系的TopLeftCorner使用“Y X”的顺序;投影坐标系、自定义坐标系、平面坐标系的TopLeftCorner使用“X Y”的顺序。

    表1 常见坐标系的TopLeftCorner顺序

             
    坐标系 4326 3857 4490

    (国家大地坐标系)


    EPSG:0

    (自定义坐标系)

    平面坐标系
    TopLeftCorner坐标顺序 YX XY YX XY XY

    请参考:

    OGC(Open Geospatial Consortium,开放地理信息联盟)WMTS 相关规范,http://www.opengeospatial.org

    展开全文
  • WMTS服务初步理解与读取当前在网络地图服务中,大部分都会采取缓存技术来替代实时对数据进行可视化,用以提高地图响应能力。介绍OGC提出的缓存技术标准的WMTS服务。WMTS简介WMTS,切片地图Web服务...
  • Add WMTS capability

    2020-12-09 04:09:18
    It would be nice to show a WMTS service is the background, instead of just the footprint overlaid on the standard basemap. <p>Rationale: an image background (served via WTMS) provides context to the...
  • Error with WMTS example

    2020-12-02 00:01:35
    ~/miniconda3/envs/py37/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py in add_wmts(self, wmts, layer_name, wmts_kwargs, **kwargs) 1939 from cartopy.io.ogc_clients import WMTSRasterSource 1940 ...
  • Implement WMTS service

    2020-12-30 04:54:12
    <p>Ports WMTS implementation to <code>next</code> branch with few additions that seemed necessary (minLevel, use of ResourceUrl so Restful encoding can be used). Global tracking issue #4218. This ...
  • Private WMTS layer

    2020-12-30 11:07:18
    <p>When a WMTS layer is not set as public, it doesn't appear in mobile layertree but it appears fine in cgxp interface (beeing connected of course). <p><img alt="image" src=...
  • <div><p>The following code manages the print configuration for WMTS layers: <p>...
  • 调用天地图WMTS服务

    2017-12-14 15:34:28
    范例使用SuperMap iClient 6R for Flex提供的WMTS图层TiledWMTSLayer调用天地图官网提供的WMTS服务。
  • <ol><li>Create WMTS mapsource file:</li></ol> <pre><code>xml $ cat << EOF > ~/.gpxsee/maps/World/Europe/FI/MapAnt.xml <?xml version="1.0" encoding="UTF-8"?> <...
  • 参考:http://www.cnblogs.com/naaoveGIS/p/5508882.htmlWMTS:WMTS是OGC制定的一种发布瓦块地图的Web服务规范,wms主要是动态地图,wmts是地图服务器预先制作好的瓦块在GIS领域,金字塔技术一直是一个基础性技术,...
  • <p>I have not been able to get a WMTS server to work with either the stable version of QGIS 1.8.0 or the current development version of 1.9 <p>This is the WMTS connection : <p>...
  • WMTS arcgisonline support

    2020-12-01 13:42:36
    <div><p>There is vast amount of free WMTS based data under https://services.arcgisonline.com/arcgis/rest/ </p> <p>eg ...
  • - https://github.com/geotools/geotools/wiki/Add-a-WMTS-CoverageReader</p> <p>GEOT ticket: - https://osgeo-org.atlassian.net/browse/GEOT-5766</p> <p>Related GeoServer work: - ...
  • Wmts Zurich not working

    2020-12-02 21:03:00
    <div><p>https://s.geo.admin.ch/738a5cdbc0 Wmts can be added but data not shown.... Maybe related to #3825</p><p>该提问来源于开源项目:geoadmin/mf-geoadmin3</p></div>
  • Slow GDAL WMTS Raster layer

    2020-12-08 23:58:39
    <div><p>Does anyway have any idea why adding and using this GDAL WMTS source as a raster layer is so slow? In QGIS the GDAL WMTS source loads for me in about 5secs, and each pan and zoom of the map on...
  • Query WMTS background layers

    2020-12-09 01:31:45
    <div><p>Closes ...<p>Querying WMTS overlays was already supported, I only added a test for it.</p><p>该提问来源于开源项目:camptocamp/ngeo</p></div>
  • custom tiles and wmts

    2020-12-26 10:37:50
    <p>Is there any way or other server that can serve local custom tiles made with MapTiler via WMTS service? Will tileserver support such a feature in future? <p>Thanks! <p>Klemen</p><p>该提问来源于...
  • add wmts canton solothurn

    2020-12-02 00:45:41
    <div><p>A test link will be added here if ...<p><a href="https://mf-geoadmin3.int.bgdi.ch/wmts-kanton-solothurn/index.html">Test link</a></p><p>该提问来源于开源项目:geoadmin/mf-geoadmin3</p></div>
  • GetCapabilities - WMS/WMTS

    2020-12-01 15:23:34
    <div><ul><li>When there are significant amount of layers GetCapabilities for WMS/WMTS can be very slow and response very big. Therefore added support to only return specific layers in GetCapabilities ...
  • leaflet 使用 wmts

    千次阅读 2017-03-23 11:05:04
    leaflet 使用 wmts一直做地图方面的页面开发,这次接到一个新需求,使用leaflet对接公司的WMTS服务。 开始干活,查看leaflet文档 http://leafletjs.com/examples/wms/wms.html,原生只支持WMS接入。于是想到了必然会...
  • <p>The question is: are there any recommended elevation WMTS services that are free for development and evaluation? I did not find so far any open-data WMTS serving elevation in BIL format. One option...
  • OGC WMTS 1.0规范的英汉对照翻译稿OGC WMTS英汉对照版(屏幕双联显示)OpenGIS® 基于Web 的地图图块服务实现标准OpenGIS® Web Map Tile Service Implementation Standard翻译:周 旭查祝华2010-10-31目 录前言91 ...
  • arcgis for js 加载天地图和wmts服务,但两者不能同时显示。WMTS服务带有密钥如何传参?
  • <div><p>This will implement #274 and add support for WMTS Capabilites without needing to connect to wmts.maptiler....<p>Please provide feedback if it is anything you want me to change.</p><p>该提问来源于...
  • <div><p>Some users requested a need to run their own WMTS for tiles stored in Amazon S3 or on a different location then their WMTS endpoint. <p>In this moment we use the ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,175
精华内容 470
关键字:

wmts