Leaflet 传单WMS设定值透明

Leaflet 传单WMS设定值透明,leaflet,geoserver,wms,Leaflet,Geoserver,Wms,我正在使用Geoserver在传单上显示WMS格式的图层点 var owsrootUrl = 'http://localhost:8081/geoserver/cite/wms'; var defaultParameters = { service : 'WFS', version : '2.0', request : 'GetFeature', transparen

我正在使用Geoserver在传单上显示WMS格式的图层点

        var owsrootUrl = 'http://localhost:8081/geoserver/cite/wms';
        var defaultParameters = {
            service : 'WFS', 
            version : '2.0',
            request : 'GetFeature',
            transparent: true,
            typeName : 'cite:transacthcmgis_salesaggregated',
            outputFormat : 'json',
            format_options : 'callback:getJson',
            SrsName : 'EPSG:4326'
        };

        var geojsonMarkerOptions = {
                radius: 0,
                fillColor: "#ff7800",
                color: "#000",
                weight: 0,
                opacity: 0,
                fillOpacity: 0.0
            };



        var parameters = L.Util.extend(defaultParameters);
        var URL = owsrootUrl + L.Util.getParamString(parameters);
        var ajax = $.ajax({
            url : URL,
            dataType : 'json',
            jsonpCallback : 'getJson',
            success : function (response) {
            L.geoJson(response, {
              style: function(geoJsonPoint, latlng) {
                return L.marker(latlng, geojsonMarkerOptions);
              },
                    onEachFeature: function (feature, url) {
                        popupOptions = {maxWidth: 250};
                        url.bindPopup("<b>Pharmacy Name:</b> " + feature.properties.customername_clients 
                            + "<br><b>adm0_zscore: </b>" + feature.properties.adm0_zscore
                            + "<br><b>adm1_zscore: </b>" + feature.properties.adm1_zscore
                            + "<br><b>adm2_zscore: </b>" + feature.properties.adm2_zscore
                            + "<br><b>adm3_zscore: </b>" + feature.properties.adm3_zscore   
                            ,popupOptions);
                    }
                }).addTo(map);
                zscore.on('add', function(evt) {
                  if (!map.hasLayer(geoJSON)) map.addLayer(geoJSON);
                });
                zscore.on('remove', function(evt) {
                  if (map.hasLayer(geoJSON)) map.removeLayer(geoJSON);
                });
              }
            });
var-owsrootUrl=”http://localhost:8081/geoserver/cite/wms';
var defaultParameters={
服务:'WFS',
版本:“2.0”,
请求:“GetFeature”,
透明:是的,
typeName:“引用:TransactionHCMGIS\u salesaggregated”,
outputFormat:'json',
格式化选项:“回调:getJson”,
SrsName:'EPSG:4326'
};
var geojsonMarkerOptions={
半径:0,
fillColor:#ff7800“,
颜色:“000”,
重量:0,,
不透明度:0,
填充不透明度:0.0
};
var参数=L.Util.extend(defaultParameters);
var URL=owsrootUrl+L.Util.getParamString(参数);
var ajax=$.ajax({
url:url,
数据类型:“json”,
jsonpCallback:'getJson',
成功:功能(响应){
L.geoJson(响应{
风格:功能(geoJsonPoint、latlng){
返回L.标记(latlng、geojsonMarkerOptions);
},
onEachFeature:函数(功能,url){
popupOptions={maxWidth:250};
bindPopup(“药房名称:”+feature.properties.customername\u客户端
+“
adm0_zscore:”+feature.properties.adm0_zscore +“
adm1_zscore:”+feature.properties.adm1_zscore +“
adm2_zscore:”+feature.properties.adm2_zscore +“
adm3_zscore:”+feature.properties.adm3_zscore ,弹出选项); } }).addTo(地图); zscore.on('add',函数(evt){ 如果(!map.hasLayer(geoJSON))map.addLayer(geoJSON); }); zscore.on('remove',函数(evt){ if(map.hasLayer(geoJSON))map.removeLayer(geoJSON); }); } });
我正在将笔划的样式设置为0,填充不透明度设置为0.0,它仍然会返回默认的传单点图标,正如您在这张图片中看到的那样

如何显示它们“透明”

让我引用我的重点:

定义GeoJSON点如何生成传单层的
函数。当添加数据时,会在内部调用它,传递GeoJSON点特性及其
LatLng
默认值是生成默认的
标记

请注意,默认的
pointToLayer
回调忽略传递给
L.GeoJSON
构造函数的
style
选项的值

我想您应该提供一个自定义的
pointToLayer
回调,这样poitn特性就会产生
L.CircleMarker
s。关于如何做到这一点,请参见。

让我引用我的重点:

定义GeoJSON点如何生成传单层的
函数。当添加数据时,会在内部调用它,传递GeoJSON点特性及其
LatLng
默认值是生成默认的
标记

请注意,默认的
pointToLayer
回调忽略传递给
L.GeoJSON
构造函数的
style
选项的值


我想您应该提供一个自定义的
pointToLayer
回调,这样poitn特性就会产生
L.CircleMarker
s。中提供了有关如何执行此操作的信息。

谢谢您的提示!我更新了代码,但还是弄不明白。仍然显示提示提示的提示!我更新了代码,但还是弄不明白。仍然显示在