【问题标题】:is there anyway we can add curved polylines in azure maps js无论如何我们可以在 azure maps js 中添加弯曲的折线
【发布时间】:2023-02-06 10:19:59
【问题描述】:

我在 azure maps 中使用了 linelayer 的 offset 属性,但它没有用

 var polylines = new atlas.layer.LineLayer(datasource2, null, {
        strokeColor: 'DarkOrchid',
        strokeWidth: ['sqrt',['sqrt',['to-number',  ['get', 'count']]]]
        ,
        filter: ['any', ['==', ['geometry-type'], 'LineString'], ['==', ['geometry-type'], 'MultiLineString']],
    });

【问题讨论】:

    标签: azure-maps


    【解决方案1】:

    你需要使用图集.data.Curve班级。此类允许您通过指定一组控制点来创建曲线。然后,您可以将这条曲线添加到数据源并使用线层渲染它。这是一个例子:

    //Create a data source and add it to the map.
    var dataSource = new atlas.source.DataSource();
    map.sources.add(dataSource);
    //Create a curved line and add it to the data source.
    dataSource.add(new atlas.data.Curve([
    [-73.972340, 40.743270],
    [-74.004420, 40.756800],
    [-74.013530, 40.722300]
    ]));
    //Create a line layer to render the line to the map.
    map.layers.add(new atlas.layer.LineLayer(dataSource, null, {
    strokeColor: 'blue',
    strokeWidth: 5
    }));
    

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 2016-03-24
      • 2021-12-29
      • 1970-01-01
      • 1970-01-01
      • 2016-03-11
      • 2019-04-09
      相关资源
      最近更新 更多