我的解决方案...
import { getBottomLeft, getBottomRight, getTopLeft, getTopRight } from 'ol/extent';
然后在您的事件/功能中使用所选功能:
const bottomLeft = getBottomLeft(feature.getGeometry().getExtent());
const bottomRight = getBottomRight(feature.getGeometry().getExtent());
const topLeft = getTopLeft(feature.getGeometry().getExtent());
const topRight = getTopRight(feature.getGeometry().getExtent());
console.log(`bottomLeft = ${ bottomLeft }, bottomRight = ${ bottomRight }, topLeft = ${ topLeft }, topRight = ${ topRight }`);
输出:
bottomLeft = 961504.4946941067,5919028.71679848, bottomRight = 961504.4946941067,5919028.71679848, topLeft = 961504.4946941067,5919028.71679848, topRight = 961504.4946941067,5919028.71679848
可以参考官方文档:https ://openlayers.org/en/latest/apidoc/module-ol_extent.html