我有一个矢量图层,其中包含从 GEOJSON 源加载的多边形和点。在我看来,点总是位于多边形上方,无论它们在源 GEOJSON 文件中的顺序如何。请参阅下面的示例定义。有没有办法,如何将点定位在同一层上的多边形下方?
示例:
点的样式为白色和红色圆圈。多边形是灰色的。
我的 GEOJSON 看起来像这样(我什至尝试颠倒文件中的特征顺序):
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"radius": "1000"
},
"geometry": {
"type": "Point",
"coordinates": [
12.4,
50.08333
]
}
},
{
"type": "Feature",
"properties": {
"radius": "800"
},
"geometry": {
"type": "Point",
"coordinates": [
12.4,
50.08333
]
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[
[
12.4,
50.08333
],
...........
最佳答案
在样式对象中使用 zIndex。
关于javascript - Openlayers 3 特征的 z 排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39875364/