Skip to content

Commit d80ce7a

Browse files
committed
[bug] 修复ol webmap 多坐标系经纬网不显示
review by zhaoq
1 parent 293d40b commit d80ce7a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,13 @@ export class WebMap extends Observable {
47234723
*/
47244724
createGraticuleLayer(layerInfo) {
47254725
const { strokeColor, strokeWidth, lineDash, extent, visible, interval, lonLabelStyle, latLabelStyle } = layerInfo;
4726+
const epsgCode = this.baseProjection;
4727+
// 除以下坐标系外,添加经纬网需要设置extent、worldExtent
4728+
if(!['EPSG:4326', 'EPSG:3857'].includes(epsgCode)) {
4729+
let projection = new olProj.get(epsgCode);
4730+
projection.setExtent(extent);
4731+
projection.setWorldExtent(olProj.transformExtent(extent, 'EPSG:4326', epsgCode));
4732+
}
47264733
let graticuleOptions = {
47274734
layerID: 'graticule_layer',
47284735
strokeStyle: new StrokeStyle({

0 commit comments

Comments
 (0)