Leaflet 带有自定义符号和弹出窗口的WFS点地图传单

Leaflet 带有自定义符号和弹出窗口的WFS点地图传单,leaflet,Leaflet,我有一个包含兴趣点的数据集。这存储在Geoserver上 我正在创建一个web地图,它将这些点作为WFS从Geoserver中拉入并显示这些点 我想点是一个不同的图标,以标准传单蓝色标记。我还需要地图有一个与POI的细节时,点击标记弹出窗口 我的问题是,标记没有从蓝色标记更改。弹出窗口正常,标记在正确的位置,但标记符号不是我设计的.png图像 这是我的密码: //Create the Points of interest WFS Layer //Style for POI Icon

我有一个包含兴趣点的数据集。这存储在Geoserver上

我正在创建一个web地图,它将这些点作为WFS从Geoserver中拉入并显示这些点

我想点是一个不同的图标,以标准传单蓝色标记。我还需要地图有一个与POI的细节时,点击标记弹出窗口

我的问题是,标记没有从蓝色标记更改。弹出窗口正常,标记在正确的位置,但标记符号不是我设计的.png图像

这是我的密码:

//Create the Points of interest WFS Layer

    //Style for POI Icon
    var POIIcon = L.icon({
        iconUrl: 'Images/defult.png', **//This is correct file path**
        iconSize: [20,20]
    });

    var owsrootUrl = 'http://geodev.co.za:8080/geoserver/SoapToAlaska/ows';
    var defaultParameters = {
        service : 'WFS',
        version : '1.0.0',
        request : 'GetFeature',
        typeName : 'SoapToAlaska:PointsOfInterestWithPitlatrines',
        outputFormat : 'text/javascript',
        format_options : 'callback:getJson',
        SrsName : 'EPSG:4326'
    };
    var parameters = L.Util.extend(defaultParameters);
    var URL = owsrootUrl + L.Util.getParamString(parameters);

    var PointsOfInterest = null;
    var ajax = $.ajax({
        url : URL,
        dataType : 'jsonp',
        jsonpCallback : 'getJson',
        success : function (response) {
            PointsOfInterest = L.geoJson(response, {
                style: function (feature) {
                    return {icon: POIIcon}; **//This is the part that doesn't seem to be working**
                },                  
                onEachFeature: function (feature, layer) {
                    popupOptions = {maxWidth: 200};
                    layer.bindPopup("Type: " + feature.properties.type, popupOptions);
                }
            })

        //Load WaterSources and PointsOfInterest WFS layers from ajax into the layer control
            LC.addOverlay(PointsOfInterest,"PointsOfInterest");
        }
    });

将图标直接添加到标记上,而不是在
样式上添加:

 var ajax = $.ajax({
        url : URL,
        dataType : 'jsonp',
        jsonpCallback : 'getJson',
        success : function (response) {
            PointsOfInterest = L.geoJson(response, {               
                onEachFeature: function (feature, layer) {
                    popupOptions = {maxWidth: 200};
                    layer.bindPopup("Type: " + feature.properties.type, popupOptions);
                    layer.setIcon(POIIcon);
                }
            })

        //Load WaterSources and PointsOfInterest WFS layers from ajax into the layer control
            LC.addOverlay(PointsOfInterest,"PointsOfInterest");
        }
    });