赞
踩
1、在配置中添加
在配置中的basemaps字段中添加
basemaps: [ { name: "山西天地图", icon: "img/basemaps/blackMarble.png", type: "wmts", url: "http://shanxi.tianditu.gov.cn/service/SX_DOM/wmts", layer: "WD_DOM", format: "image/tile", tileMatrixSetID: "Matrix_WD_DOM_1", crs: "EPSG:4490", proxy: "//server.mars3d.cn/proxy/", // 代理服务,解决跨域问题 show: true }, { name: "单张图片", icon: "img/basemaps/offline.png", type: "image", url: "//data.mars3d.cn/file/img/world/world.jpg", show: false } ]
2、在创建地球后调用addLayer添加图层(直接new对应type类型的图层类)
tileLayer = new mars3d.layer.WmtsLayer({ url: "//server.mars3d.cn/geoserver/gwc/service/wmts", layer: "mars:hfgh", format: "image/png", tileMatrixSetID: "EPSG:4326", crs: "EPSG:4326", alpha: 0.8, pickFeaturesUrl: "//server.mars3d.cn/geoserver/mars/wms", popup: "all", highlight: { type: "wallP", diffHeight: 100, materialType: mars3d.MaterialType.LineFlow, materialOptions: { image: "img/textures/fence.png", color: "#ffff00", speed: 10, // 速度,建议取值范围1-100 axisY: true } }, flyTo: true }) map.addLayer(tileLayer)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。