【OpenLayers笔记】加载天地图
const map = new Map({ target: "map", layers: [ new TileLayer({ source: new XYZ({ url: "http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=在天地图里申请的key", }), }), ], view: new View({ maxZoom: 18, center: fromLonLat([114, 24]), zoom: 12, }), });
tip:如果地图不自带标注需要再添加一个标注图层