简体   繁体   English

线串末端的 Mapbox 样式圆圈

[英]Mapbox style circles at ends of linestrings

I'd like to render circles at only the ends of LineStrings, ideally without creating a separate duplicative data source.我只想在 LineStrings 的末端渲染圆圈,理想情况下不创建单独的重复数据源。

I have LineStrings representing trails from the OpenMapTiles project.我有 LineStrings 表示来自 OpenMapTiles 项目的路径。 They render fine using the line layer style type, but when I try to render with the circle layer style type, it renders a circle at every vertex, and not just the ends.它们使用line图层样式类型渲染得很好,但是当我尝试使用circle图层样式类型渲染时,它会在每个顶点渲染一个圆,而不仅仅是末端。 Is there a filter expression I could use to show these circles at only the ends?是否有过滤器表达式可用于仅在末端显示这些圆圈?

Here's the style layer that is rendering the points in the image below:这是渲染下图中点的样式层:

    {
      "id": "road_path_pedestrian_trail_ends",
      "type": "circle",
      "source": "openmaptiles",
      "source-layer": "transportation",
      "minzoom": 13,
      "filter": [
        "all",
        ["==", "$type", "LineString"],
        ["!in", "brunnel", "bridge", "tunnel"],
        ["in", "class", "path", "pedestrian"],
        ["in", "subclass", "path", "footway"]
      ],
      "layout": {"visibility": "visible"},
      "paint": {}
    }

在此处输入图片说明

As far as I'm aware, there is no way to distinguish a line endpoint from any other vertex.据我所知,没有办法将线端点与任何其他顶点区分开来。

You could maaaaaybe get something of the effect you want by rendering two lines, one with line-end: round , a different color, under the other line which has line-end: butt .您可以 maaaaaybe 通过渲染两条线来获得您想要的效果,其中一条line-end: round带有line-end: round ,一种不同的颜色,位于另一条line-end: butt You'd get a tiny half-circle thing which may be better than nothing?你会得到一个小半圆的东西,这可能比没有好?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM