openlayer 5 获取中心点

之前在控制台把map对象打印出来后,有一个很像中心点坐标map.focus_。我可以确定的告诉大家,这个不是中心点坐标,检查出来的结果是地图中心最右的点位。

在创建地图时,会将中心点左边写在view中,那么获取中心点坐标也是在view中

在官网中View中有一个事件--calculateExtent(opt_size)

官网中是这么介绍的

Calculate the extent for the current view state and the passed size. The size is the pixel dimensions of the box into which the calculated extent should fit. In most cases you want to get the extent of the entire map, that is map.getSize().

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wppfjp.html