北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
ZhAkps
2024-02-06 478b9027e30a8ea8eba0c9360654b5f05fce62e5
src/components/sideMenu/layerMenu/layerPanel2.vue
@@ -110,10 +110,10 @@
import ZTTitem from "@/utils/ztt2.js";
import { layers } from "../../../../static/json/layer.js";
import Tile from "ol/layer/Tile";
import XYZ from "ol/source/XYZ";
import { get as getProjection, getTransform } from "ol/proj";
import { createXYZ } from "ol/tilegrid";
// import Tile from "ol/layer/Tile";
// import XYZ from "ol/source/XYZ";
// import { get as getProjection, getTransform } from "ol/proj";
// import { createXYZ } from "ol/tilegrid";
export default {
  name: "LayerPanel",
@@ -478,16 +478,17 @@
            // });
            // window.map.addLayer(window.tdglLayer);
            var url =
              "https://skyzt.bda.gov.cn/gisserver/tmsserver/chengshiguihua_dikuaibianhao_tms/";
            var projection = getProjection("EPSG:4326");
            var tmslayer = new Tile({
              source: new XYZ({
            // var url =
            //   "https://skyzt.bda.gov.cn/gisserver/tmsserver/chengshiguihua_dikuaibianhao_tms/";
            var tmslayer = new ol.layer.Tile({
              source: new ol.source.XYZ({
                projection: projection,
                tileGrid: createXYZ({
                  extent: projection.getExtent(),
                tileGrid: ol.tilegrid.createXYZ({
                  extent: [50.731, -90, 180, 70.0478],
                }),
                tileUrlFunction: function (tileCoord, pixelRatio, proj) {
                  // return url + (tileCoord[0] - 1) + '/' + tileCoord[1] + '/' + (Math.pow(2, tileCoord[0] - 1) + tileCoord[2]) + '.jpeg';
                  return (
                    url +
                    (tileCoord[0] - 1) +