my-openlayer 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import Map from "ol/Map";
5
5
  import { Tile as TileLayer } from "ol/layer";
6
- import { WMTS } from "ol/source";
7
6
  import WMTSTileGrid from "ol/tilegrid/WMTS";
8
7
  import XYZ from "ol/source/XYZ";
9
8
  import { MapLayersOptions, TiandituType, AnnotationLayerOptions } from "../types";
@@ -23,7 +22,7 @@ export default class MapBaseLayers {
23
22
  token: string;
24
23
  zIndex: number;
25
24
  visible: boolean;
26
- }): TileLayer<WMTS>;
25
+ }): TileLayer<XYZ>;
27
26
  /**
28
27
  * 地图注记
29
28
  */
@@ -4,7 +4,7 @@
4
4
  import { Tile as TileLayer } from "ol/layer";
5
5
  import { get as getProjection } from "ol/proj";
6
6
  import { getTopLeft, getWidth } from "ol/extent";
7
- import { WMTS } from "ol/source";
7
+ // import { WMTS } from "ol/source";
8
8
  import WMTSTileGrid from "ol/tilegrid/WMTS";
9
9
  import XYZ from "ol/source/XYZ";
10
10
  import MapTools from "./MapTools";
@@ -111,14 +111,9 @@ export default class MapBaseLayers {
111
111
  //img_c 影像底图 ter_c 地形底图
112
112
  static getTiandiTuLayer(options) {
113
113
  return new TileLayer({
114
- source: new WMTS({
115
- url: `https://t{0-7}.tianditu.gov.cn/${options.type}/wmts?tk=${options.token}`,
116
- layer: 'img',
117
- style: 'default',
118
- matrixSet: 'c',
119
- format: 'tiles',
120
- wrapX: true,
121
- tileGrid: this.getTileGrid(19)
114
+ source: new XYZ({
115
+ url: `//t{0-7}.tianditu.gov.cn/DataServer?T=${options.type}&tk=${options.token}&x={x}&y={y}&l={z}`,
116
+ projection: 'EPSG:4326'
122
117
  }),
123
118
  zIndex: options.zIndex,
124
119
  visible: options.visible
@@ -130,7 +125,7 @@ export default class MapBaseLayers {
130
125
  static getAnnotationLayer(options) {
131
126
  return new TileLayer({
132
127
  source: new XYZ({
133
- url: `http://t{0-7}.tianditu.gov.cn/DataServer?T=${options.type}&tk=${options.token}&x={x}&y={y}&l={z}`,
128
+ url: `//t{0-7}.tianditu.gov.cn/DataServer?T=${options.type}&tk=${options.token}&x={x}&y={y}&l={z}`,
134
129
  projection: 'EPSG:4326'
135
130
  }),
136
131
  zIndex: options.zIndex,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "0.1.11",
4
+ "version": "0.1.12",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",