surprise
2024-03-05 1ce1b525e7470ebaaeb0d5cd1e59bd905c1a7114
src/components/ProjectOl.vue
@@ -15,16 +15,6 @@
        <el-form-item :label="$t('dataManage.projectObj.latitude')">
          {{formInline.lat}}
        </el-form-item>
        <el-form-item :label="$t('dataManage.projectObj.country')">
          {{formInline.country}}
        </el-form-item>
        <el-form-item :label="$t('dataManage.projectObj.province')">
          {{formInline.province}}
        </el-form-item>
        <el-form-item :label="$t('dataManage.projectObj.county')">
          {{formInline.location}}
        </el-form-item>
        <el-form-item>
          <el-button
            type="success"
@@ -75,13 +65,18 @@
    initOlMap() {
      var val = 'http://{host}/LFData/2d/tiles/img/{z}/{x}/{y}.png';
      if (val.indexOf('{host}') > -1) {
        val = val.replace("{host}", iisHost)
      }
      // var val = 'http://{host}/LFData/2d/tiles/img/{z}/{x}/{y}.png';
      // if (val.indexOf('{host}') > -1) {
      //   val = val.replace("{host}", iisHost)
      // }
      var vectorLayer = new TileLayer({
        source: new XYZ({
          url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}",
          url: "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=94a34772eb88317fcbf8428e10448561",
        }),
      });
      var vectorLayer1 = new TileLayer({
        source: new XYZ({
          url: "http://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=94a34772eb88317fcbf8428e10448561",
        }),
      });
@@ -89,10 +84,10 @@
      this.mapol = new Map({
        target: 'mapView',
        layers: [vectorLayer],
        layers: [vectorLayer,vectorLayer1],
        view: new View({
          center: transform([105.02, 34.9], 'EPSG:4326', 'EPSG:3857'),
          zoom: 4,
          center: transform([112.5545931210261, 37.86275646283009], 'EPSG:4326', 'EPSG:3857'),
          zoom: 12,
          projection: 'EPSG:3857',
        }),
      });
@@ -166,7 +161,8 @@
        let geom = feature.getGeometry();
        var extent = geom.flatCoordinates;
        var a1 = transform([extent[0], extent[1]], 'EPSG:3857', 'EPSG:4326');
        this.showLoacation(a1)
        this.formInline.lon = parseFloat(a1[0]).toFixed(6);
      this.formInline.lat = parseFloat(a1[1]).toFixed(6);
        this.$store.state.projeOl =
          'POINT(' + a1[0].toFixed(6) + ' ' + a1[1].toFixed(6) + ')';
        this.mapol.removeInteraction(this.draw);