如何在 Azure Maps 中获取地图视图范围内的所有可见点

How to get all visible points in the map view bounds in Azure Maps

我一直在搜索并尝试在多边形示例中使用 select 点的示例,但是我没有绘制新的多边形,而是地图中已经有一个用作 select离子边界。我在地图上也有很多点,但有些点在视图之外或可能由于缩放比例而隐藏,所以我 w/ant 忽略所有这些点,即使它们在 select离子多边形。这可能吗?

// searchArea is populated by click method
    function searchPolygon(searchArea) {
        var visiblePointsOnly = ???;
        var poly = searchArea.toJson(); // This is failing saying toJson not a function?

        // Calculate all points that are within the polygon area.
        var ptsWithin = turf.pointsWithinPolygon(visiblePointsOnly, poly);

        return ptsWithin;
    }

TIA! 瑞克...

我设法弄明白了...可能不是最好的,但它满足了我的需要!

function searchPolygon(searchArea) {
    // Get points visible on map
    var points = pointLayer.getSource();

    if(points){
        var poly = searchArea.shapes[0].toJson();
        points = points.shapes[0].toJson();

        // Calculate all points that are within the polygon area.
        var ptsWithin = turf.pointsWithinPolygon(points, poly);
    }

    return ptsWithin;
}

希望这会帮助其他需要相同功能的人, 干杯! 瑞克...