如何在 Here Maps 中拖动地图后获得边界
How to get bounds after map drag in Here Maps
在 dragend 事件之后,我在获取 Here maps 中的地图边界时遇到了问题。
我需要新的纬度、经度来在新更改的视口中获得一些 items/points。
我只想在拖动结束时获取 google 地图 map.getBounds().getNorthEast().lat() 的替代方案。
我已经尝试过这些方法,但其中 none 返回了东北和西南坐标的纬度、经度位置。
Heremap.addEventListener('dragend', (ev) => {
const target = ev.target;
// console.log(map.getViewModel().getLookAtData().bounds);
// console.log(map.getBounds());
// console.log(target.getViewPort());
// console.log(target.getBoundingBox());
}, false);
请参阅此文档:
H.map.ViewModel :
https://developer.here.com/documentation/maps/topics_api/h-map-viewmodel.html#h-map-viewmodel__getlookatdata
H.map.ViewModel.ILookAtData :
https://developer.here.com/documentation/maps/topics_api/h-map-viewmodel-ilookatdata.html#h-map-viewmodel-ilookatdata__bounds
H.geo.Rect
https://developer.here.com/documentation/maps/topics_api/h-geo-rect.html#h-geo-rect
这是一些代码片段:
map.addEventListener('dragend', (ev) => {
var bounds = map.getViewModel().getLookAtData().bounds;
});
在 dragend 事件之后,我在获取 Here maps 中的地图边界时遇到了问题。 我需要新的纬度、经度来在新更改的视口中获得一些 items/points。 我只想在拖动结束时获取 google 地图 map.getBounds().getNorthEast().lat() 的替代方案。
我已经尝试过这些方法,但其中 none 返回了东北和西南坐标的纬度、经度位置。
Heremap.addEventListener('dragend', (ev) => {
const target = ev.target;
// console.log(map.getViewModel().getLookAtData().bounds);
// console.log(map.getBounds());
// console.log(target.getViewPort());
// console.log(target.getBoundingBox());
}, false);
请参阅此文档:
H.map.ViewModel : https://developer.here.com/documentation/maps/topics_api/h-map-viewmodel.html#h-map-viewmodel__getlookatdata
H.map.ViewModel.ILookAtData : https://developer.here.com/documentation/maps/topics_api/h-map-viewmodel-ilookatdata.html#h-map-viewmodel-ilookatdata__bounds
H.geo.Rect https://developer.here.com/documentation/maps/topics_api/h-geo-rect.html#h-geo-rect
这是一些代码片段:
map.addEventListener('dragend', (ev) => {
var bounds = map.getViewModel().getLookAtData().bounds;
});