OpenLayers根据输入坐标居中定位显示功能

想实现根据输入x,y坐标,居中显示效果

map.getView().animate({ // 只设置需要的属性即可
    center: [经度,纬度 ], // 中心点
    zoom: 15, // 缩放级别
    rotation: undefined, // 缩放完成view视图旋转弧度
    duration: 1000 // 缩放持续时间,默认不需要设置
})

 

点击Position按钮(button),就会以该坐标为center居中显示,设置zoom为18,可以更准确地定位。

>>openlayers3教程:https://www.cnblogs.com/benmumu/p/8081068.html

参考:https://ask.csdn.net/questions/222910?sort=votes_count

原文地址:https://www.cnblogs.com/2008nmj/p/14087005.html