如何增加Vaadin地图中的最大标记数?
在Vaadin地图(Vaadin 23)中,我发现仅在地图上显示一定数量的标记。例如,我如何出现说500个标记(如下面的代码中的500个位置)?
locations.stream().forEach(location -> {
Coordinate coordinate = Coordinate.fromLonLat(Double.parseDouble(location.getLon()), Double.parseDouble(location.getLat()));
MarkerFeature customerMarker = new MarkerFeature(coordinate);
map.getFeatureLayer().addFeature(customerMarker);
});
In Vaadin Maps (Vaadin 23) I'm finding that only a certain number of markers are displayed on the map. How do I for example show up to say 500 markers (as in 500 locations in the code below)?
locations.stream().forEach(location -> {
Coordinate coordinate = Coordinate.fromLonLat(Double.parseDouble(location.getLon()), Double.parseDouble(location.getLat()));
MarkerFeature customerMarker = new MarkerFeature(coordinate);
map.getFeatureLayer().addFeature(customerMarker);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢您查看新的地图组件。
您可以添加的标记数量不应受到任何限制,无论是来自 Vaadin 组件还是底层 OpenLayers 库。
以下是显示 500 个标记的示例:
您可以检查的一件事是所有位置是否实际上都有唯一的坐标,也许存在一些重叠。例如,如果经度/纬度超出范围,则使用
Cooperative.fromLonLat
方法来修剪值,在这种情况下,这会将多个标记放置在同一位置。除此之外,您始终可以通过复制打开问题,我们会看一下。
thanks for checking out the new Map component.
There shouldn't be any limit to the number of markers that you can add, neither from the Vaadin component, nor the underlying OpenLayers library.
Here is an example that displays 500 markers:
One thing you could check is whether all locations actually have unique coordinates, maybe there are some overlaps. For example the
Coordinate.fromLonLat
method you use trims values if longitude/latitude are out of bounds, which would put multiple markers in the same location in that case.Apart from that you can always open an issue with a reproduction, and we'll take a look.