Openlayers带有点和名称的Linestring

时间:2018-03-16 11:54:49

标签: openlayers multilinestring

是否可以在所提到的坐标上创建一个带有点的线串,以及该线串的名称。

for (var i = 0; i < wp.length; i++) {
            wp[i] = ol.proj.transform(wp[i], 'EPSG:4326', 'EPSG:3857');
            //console.log(wp);

        }
        var wpfeatureLine = new ol.Feature({
            geometry: new ol.geom.LineString(wp)
        });

        var wpline = new ol.source.Vector({

        });
        wpline.addFeature(wpfeatureLine); //lined or a waypoint feature on map
        //wpline.addFeature(CircleFeature);


        var vectorLineLayer = new ol.layer.Vector({
            source: wpline,
            style: new ol.style.Style({
                fill: new ol.style.Fill({ color: '#000000', weight: 4 }),
                stroke: new ol.style.Stroke({ color: '#000000', width: 2 })
            })
        });

        map.addLayer(vectorLineLayer);

1 个答案:

答案 0 :(得分:1)

您可以为每个线坐标添加点要素。

(e)poll()