首页 / 浏览问题 / WebGIS / 问题详情
用Leaflet添加了图层切换空间,无法显示覆盖使用的面图层
2EXP 2023年03月28日
<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <script src="dist/leaflet/include-leaflet.js"></script>

</head>

<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">

   <div id="map" style="width:1500px;height:800px"></div>

<script>

   var host = window.isLocal ? window.server : "http://localhost:8090";

   var SC = L.marker([30.39,103.01]).bindPopup('四川省');

   var province = L.layerGroup([SC]);

   var Vec = L.supermap.tiandituTileLayer({key:"9889d546b726a1ddac95a92d357eb8bd",layerType:"vec",noWrap:true});

   var Img = L.supermap.tiandituTileLayer({key:"9889d546b726a1ddac95a92d357eb8bd",layerType:"img",noWrap:true});

   var Ter = L.supermap.tiandituTileLayer({key:"9889d546b726a1ddac95a92d357eb8bd",layerType:"ter",noWrap:true});

   var url = host + "/iserver/services/map-SiChuan/rest/maps/SiChuanMap";

   var map = L.map("map",{

   crs:L.CRS.EPSG4326,

   center:{lon:103.01,lat:30.39},

   zoom:5,

   maxZoom:18,

   layers: [Vec, province],

   });

   L.supermap.tiandituTileLayer({key:"9889d546b726a1ddac95a92d357eb8bd",

   layerType:"vec"}).addTo(map);

   //叠加地图图层,关键参数:transparent、opacity、noWrap

   L.supermap.tiledMapLayer(url,{

   transparent:true,

   opacity:0.8,}).addTo(map);

   var baseMaps = {

   "矢量":Vec,

   "影像":Img,

   "地形":Ter

   }var overlayMaps = {"Province" : province}; L.control.layers(baseMaps, overlayMaps).addTo(map);</script></body></html>

1个回答

您好,只看您的代码并不能理解您想要问的问题。

请您清晰具体的描述下您的数据情况、使用情况、想要的效果和遇到的问题,才能知道您的问题是什么意思。

希望可以帮助到您。
10,538EXP 2023年03月28日
...