i具有以下GEO JSON的多点功能。
{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [
[
-123,
58
],
[
-152.32,
17.5
],
[
52.02,
42.64
]
]
}
}
当我在地图上绘制此图并通过样式函数应用任何图标时,它应用于所有点。有什么方法可以在多点功能中为每个坐标添加不同的标记?
在多点中为不同的坐标应用不同的样式,需要为每个坐标编写不同的样式。我在Plunker中创建了一个视图。在此链接
中浏览代码new ol.style.Style({
image: new ol.style.Circle({
radius: 5,
fill: new ol.style.Fill({
color: 'orange'
})
}),
geometry: function(feature) {
var coordinates = feature.getGeometry().getCoordinates();
return new ol.geom.Point(coordinates[0]);
}
})
在几何函数中考虑单个坐标并为其应用样式。
注意:如果多点具有更多的积分,则代码将被肿。