推荐 最新
米斯达

解决OpenLayers postcompose事件event.vectorContext获取失败的问题?

openlayers 使用地图postcompose事件event.vectorContext 为什么获取不到呢? 通过openlayers添加点然后实现点位闪烁效果 flash(feature) { var _this = this; var start = new Date().getTime(); var listenerKey; function animate(event) { debugger; var duration = 1000; var vectorContext = event.vectorContext; var frameState = event.frameState; var flashGeom = feature.getGeometry().clone(); var elapsed = frameState.time - start; var elapsedRatio = elapsed / duration; // var radius = ol.easing.easeOut(elapsedRatio) * 6 + 5; // var opacity = ol.easing.easeOut(1 - elapsedRatio); var radius = 10; var opacity = 1; console.log("radius:::" + radius + ":::opacity:::" + opacity) var style = new Style({ image: new Circle({ radius: radius, snapToPixel: false, stroke: new Stroke({ color: 'rgba(255, 0, 0, ' + opacity + ')', width: 0.25 + opacity }) }) }); vectorContext.setStyle(style); vectorContext.drawGeometry(flashGeom); if (elapsed > duration) { ol.Observable.unByKey(listenerKey); return; } _this.map.render(); } listenerKey = _this.map.on('postcompose', animate); }

0
1
0
浏览量188
时光旅人

使用OpenLayers根据经纬度及步长生成网格?

使用OpenLayers绘制简单网格? 像下面这样,求助 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241007/fba83ab3350649e8dcfb327f6bf57b17.png) 根据提供的经纬度 startPosition, endPosition, step 两个点的经纬度(生成的大网格对角线),和步长(一个正方形小网格的长度),计算生成网格,后面还想能鼠标框选多个小网格,设置框选的多个小网格处的数据信息 const generateGrid = (startPosition, endPosition, step) => { }

0
1
0
浏览量151
001

OpenLayers地图中心点修改无效,可能的原因及解决方案?

OpenLayers 地图设置中心点不生效 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/f5b53b88a301c3af108f665ed063985c.png)初始化是设置了一个默认点 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/273dd78459bbcea2091421c0e1a62c35.png)在后面定义了一个方法去修改他的中心点位置及缩放程度 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/05ee19d25bf5a8e0133bde9ad64de27e.png)在其他页面使用时 无论怎么修改都不生效 我不用这个方法使用默认点依旧没有生效 求求各位大佬看看,小弟没有搞过这个 但是我看了他的文档好像确实这么写的

0
1
0
浏览量169
无敌英俊大师兄

ol-ext如何实现图案填充效果?

想要通过ol-ext实现这种图案填充效果,ol-ext本身的FillPattern不能用吗?我已经安装ol-ext 如何才能使用引用此方法呢? "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241001/c2c738ca08f230e7c5bc150151b5e48a.png) 想要通过ol-ext实现这种图案填充效果 已安装ol-ext 通过import { FillPattern } from 'ol-ext/style'; 会提示To install it, you can run: npm install --save ol-ext/style

0
1
0
浏览量121
瞳孔放大黑洞

openlayer new Style 如何画出一下两种效果?

"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241213/a17195f9f157c235242e1e64113d9264.png) 请问一下 openlayer 咋样实现一下两种效果。 1、圆点 + 指针 + 扇形范围。 补充,扇形和 指针的指向 和角度 是通过 方位角 指定的 "{\"方位角\":\" 东南114°\",\"水平角\":\" 28°\",\"俯仰角\":\" 62°\",\"横滚角\":\" 7°\"}" 2、圆点 + 指针。 /** 照片 标记 点 高亮 */ const pointStyle = new Style({ image: new Circle({ radius: 6, fill: new Fill({ color: 'red', }), stroke: new Stroke({ color: '#fff', width: 2 }), }), });

0
1
0
浏览量20