FWQ
OpenLayers 6 中如何获取 postcompose 事件的 vectorContext?
OpenLayers 6 中如何获取 postcompose 事件的 vectorContext? 有志者,事竟成!如果你在学习文章,那么本文《OpenLayers 6 中如何获取 postcompose 事件的 vectorContext?》,就很适合你!文章讲解的知识点主要包括,若是你对本文感兴趣,或者是想搞懂其中某个知识点,就请你继续往下看吧~ openlayers中postcompose事件event.vectorcontext获取不到的解决办法 在openlayers 3中,通过map的postcompose事件获取event.vectorcontext可能失败。这是因为在openlayers 6中,该事件被替换为postrender事件,并且getvectorcontext函数已被引入以访问即时矢量渲染api。 解决方法: 要在openlayers 6中获取vectorcontext,请使用以下步骤: 导入getvectorcontext函数: import {getvectorcontext} from 'ol/render'; 使用postrender事件监听图层: layer.on('postrender', function(event) {…