传单tilelayer wms和tilelayer z-index

时间:2018-09-27 07:13:51

标签: javascript angularjs leaflet

我对z-index有问题。我搜索了但没有得到正确的结果。首先,我将google tilelayer用于以下

 $scope.maplayer = L.tileLayer('https://{s}.google.com/vt/lyrs=s,h&hl=x-local&x={x}&y={y}&z={z}', {
            subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
 }).addTo($scope.map);

我创建了几个复选框。选中此复选框时,将调用wms。

HTML

<div class="layer-group">
    <input type="checkbox" id="townBorder" class="layersCheck" data-permission="true" data-id="12" data-lejant="spt_dis_il" data-max-zoom="30" data-min-zoom="5" data-layer="ADR_geo:spt_dis_il" data-ng-click="toggleWMSLayer($event);"> 
    <label  for="townBorder">Town</label> 
</div>            
<div class="layer-group">
    <input type="checkbox" id="havamania" class="layersCheck" data-permission="true" data-id="3" data-lejant="havamania" data-max-zoom="30" data-min-zoom="5" data-layer="adr_v4:k_spt_havamania" data-ng-click="toggleWMSLayer($event);"> 
    <label  for="havamania">Havamania</label> 
</div>

JS

   $scope.toggleWMSLayer = function ($event) {           
        $scope.lejant = ($($event.currentTarget).attr("data-lejant")) ? $($event.currentTarget).attr("data-lejant") : null;            
        if ($($event.currentTarget).is(':checked')) {               
            $scope.wmsLayer = L.tileLayer.wms('http://localhost:3000/geo/wms', {
                layers: $($event.currentTarget).attr("data-layer"),
                format: 'image/png',
                transparency: true,
                opacity: 0.5,
                styles: $($event.currentTarget).attr("data-style") ? $($event.currentTarget).attr("data-style") : '',
                cql_filter: $($event.currentTarget).attr("data-cql") ? $($event.currentTarget).attr("data-cql") : '1=1',
                id: $($event.currentTarget).attr("data-id"),
                permission: $($event.currentTarget).attr("data-permission"),                    
            }).addTo($scope.map);

            $scope.wmsArray.push($scope.wmsLayer);                
        } else {
            for (var a = 0; a < $scope.wmsArray.length; a++) {               
                if ($scope.wmsArray.length == 0) {
                    $scope.map.removeLayer($scope.wmsLayer2);
                    $scope.wmsLayer2Status = false;
                }
            }
        }
    }

在这里,我想更改tileLayertileLayer.wms的z-index。我该怎么办?

0 个答案:

没有答案