校园-江西科技师范大学-前端
shuishen
2023-12-07 24b0b99f7125880bdee544caec0bd68d372050ab
src/store/modules/openlayerData.js
@@ -42,32 +42,6 @@
import TilegridTileGrid from "ol/tilegrid/TileGrid";
const tileUrl =
  "https://fkxt.jxstnu.edu.cn/changjing/arcgis/rest/services/ksd1/MapServer/tile/{z}/{y}/{x}";
// 坐标原点
const origin = [-400.0, 399.9999999999998];
// 分辨率
const resolutions = [
  0.00019035688046642243, 0.00014276766034981682, 0.00009517844023321122,
  0.00004758922011660561,
];
const fullExtent = [
  112.51302281804038, -0.17416638494176828, 112.76131189483516,
  0.000004509395743004334,
];
const tileGrid = new TilegridTileGrid({
  tileSize: 256,
  origin: origin,
  extent: fullExtent,
  resolutions: resolutions,
});
// 瓦片数据源
const tileArcGISXYZ = new XYZ({
  tileGrid: tileGrid,
  projection: "EPSG:4326",
  url: tileUrl,
});
const openlayerData = {
  state: {
    mapscene: {
@@ -75,20 +49,8 @@
    },
    openlayers: {
      map2D: new OlMap({
        layers: [
          // 瓦片图层
          //   new OlLayerTile({
          //     source: tileArcGISXYZ,
          //   }),
        ],
        view: new OlView({
          // 初始化中心点坐标
          //   center: [112.63716735643777, -0.087080937773012637833],
          // 注意:此处指定缩放级别不能通过zoom来指定,指定了也无效,必须通过resolution来指定
          //   resolution: 0.00014276766034981682,
          projection: "EPSG:4326",
          //   extent: fullExtent,
        }),
        layers: [],
        view: new OlView({}),
      }),
      map3D: null,