[英]Symbol placed with line-center doesn't rotate as the map rotates
I'm having a problem rotating an image with property symbol-placement
set to line-center
.我在旋转属性
symbol-placement
设置为line-center
的图像时遇到问题。 This is what it looks like这是它的样子
Removing the property half-solve the issue;移除财产就解决了一半的问题; the icon rotate as I rotate the map, but they position at the start of the line, and it's not what I'm trying to do.
图标随着我旋转地图而旋转,但它们位于行的开头,这不是我想要做的。
The definition of my layer is:我的层的定义是:
{
"id": "my_symbol",
"type": "symbol",
"source": "XXXX",
"source-layer": "XXXXXXX",
"minzoom": 19,
"layout": {
"symbol-placement": "line-center",
"icon-size": {
"stops": [
[20, 0.2],
[21, 0.1],
[22, 0.3],
[23, 0.5],
[24, 0.7]
]
},
"icon-image": [
"concat",
"edge_",
["get", "status_list"]
],
"icon-allow-overlap": true
}
}
I'm trying to achieve this behaviour only by the layer's definition.我试图仅通过层的定义来实现这种行为。 I tried looking for a solution, here on SO and on some other sites but I haven't found anything that would help me.
我试图在 SO 和其他一些网站上寻找解决方案,但我没有找到任何可以帮助我的东西。
you can set your icon rotation with icon-rotation-alignment
您可以使用
icon-rotation-alignment
设置图标旋转
setting it to viewport
will fix the icon rotation to your viewport while setting it to map
won't rotate it将其设置为
viewport
会将图标旋转固定到您的视口,而将其设置为map
不会旋转它
i'm sorry the gif is hard to see!很抱歉 gif 很难看!
{
"id": "my_symbol",
"type": "symbol",
"source": "XXXX",
"source-layer": "XXXXXXX",
"minzoom": 19,
"layout": {
"symbol-placement": "line-center",
"icon-size": {
"stops": [
[20, 0.2],
[21, 0.1],
[22, 0.3],
[23, 0.5],
[24, 0.7]
]
},
"icon-image": [
"concat",
"edge_",
["get", "status_list"]
],
"icon-allow-overlap": true,
"symbol-placement": "line-center",
"icon-rotation-alignment": "viewport"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.