五十八、openlayers官网示例Map Graticule解析——给地图添加经纬度网格线

这篇没啥好说的,写出来完全是嘲笑一下自己蠢,以及,,,帮大家避个坑。。。。

之前一个项目需要展示这种经纬线,但是我不知道openlayers有这种图层,于是拿canvas画上去的。。。。

很好,又是被自己蠢哭的一天。。 。

import Graticule from 'ol/layer/Graticule.js';
import Map from 'ol/Map.js';
import OSM from 'ol/source/OSM.js';
import Stroke from 'ol/style/Stroke.js';
import TileLayer from 'ol/layer/Tile.js';
import View from 'ol/View.js';
import {fromLonLat} from 'ol/proj.js';

const map = new Map({
  layers: [
    new TileLayer({
      source: new OSM({
        wrapX: false,
      }),
    }),
    new Graticule({
      // the style to use for the lines, optional.
      strok
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值