vue2中CesiumV1.113.0加载离线地形数据

news2024/10/6 0:36:25
 离线地形数据可以放在vue项目下的public/data/sjzTerrain文件下 
 由于地形离线数据数量太大,在vue项目编译时会报如下错误:

 ERROR in EMFILE: too many open files, open 'D:\test_project\vue_cesium_demo\public\data\sjzTerrain\.tmp\14\26787\11669.hm'

这时,我们可以把离线地形数据放在本机的iis上 

然后运行项目,不会报上面的错误了

 

   // 加载地形数据
        viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
          url: "https://[ t0-t7 ].tianditu.gov.cn/mapservice/swdx?tk=天地图token", //"data/sjzTerrain/", //"http://192.168.1.143:8963/",// Cesium.IonResource.fromAssetId(1), 
          requestWaterMask: true, // 控制水的流动效果
          requestVertexNormals: true, //请求地形照明数据
        });
        viewer.scene.globe.enableLighting = true;
     new Promise(async (resolve, reject) => {
        this.viewer = new Cesium.Viewer(this.$refs.cesiumContainer, {
          selectionIndicator: false,
          infoBox: false,
          contextOptions: {
            // 硬件反走样,默认值为 1
            msaaLevel: 8,
            requestWebgl2: true,
          },
          animation: false,
          timeline: false, // 底部时间线
          fullscreenButton: false, // 全屏
          vrButton: false, // VR
          sceneModePicker: false, // 选择视角的模式(球体、平铺、斜视平铺)
          baseLayerPicker: false, // 图层选择器(地形影像服务)
          navigationHelpButton: false, // 导航帮助(手势,鼠标)
          geocoder: false, // 位置查找工具
          homeButton: false, // 视角返回初始位置
        });
        this.viewer.scene.globe.baseColor = Cesium.Color.BLACK; // 设置地球颜色
        this.viewer.cesiumWidget.creditContainer.style.display = "none"; // 去除logo
        window.viewer = this.viewer;
        // 加载地形数据
        viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
          url: "https://[ t0-t7 ].tianditu.gov.cn/mapservice/swdx?tk=175171c959b6f72e789fb3c45a266d55", //"data/sjzTerrain/", //"http://192.168.1.143:8963/",// Cesium.IonResource.fromAssetId(1), //"http://192.168.1.143:8963/"
          requestWaterMask: true, // 控制水的流动效果
          requestVertexNormals: true, //请求地形照明数据
        });
        viewer.scene.globe.enableLighting = true;
        resolve(viewer);
      }).then(() => {
       
      });
加载地形数据后,可以根据经纬度获取高程
const positions = [
          Cesium.Cartographic.fromDegrees(
            114.22268842439114,
            38.134979272096594
          ),
          Cesium.Cartographic.fromDegrees(114.5199580178976, 38.1139391070047),
        ];
        const updatedPositions = await Cesium.sampleTerrainMostDetailed(
          viewer.terrainProvider,
          positions
        );
        console.log(`updatedPositions`, updatedPositions);
        try {
          const updatedPositions2 = await Cesium.sampleTerrainMostDetailed(
            viewer.terrainProvider,
            positions,
            true
          );
          console.log(`updatedPositions2`, updatedPositions2);
        } catch (error) {
          // A tile request error occurred.
        }

        const updatedPositions3 = await Cesium.sampleTerrain(
          viewer.terrainProvider,
          10,
          positions
        );
        console.log(`updatedPositions3`, updatedPositions3);
        try {
          const updatedPositions4 = await Cesium.sampleTerrain(
            viewer.terrainProvider,
            10,
            positions,
            true
          );
          console.log(`updatedPositions4`, updatedPositions4);
        } catch (error) {
          // A tile request error occurred.
        }
 完整代码
<template>
  <div class="CesiumOutbox">
    <div ref="cesiumContainer" class="cesiumContainerbox"></div>
    <button @click="HomeFun" class="Btnbox">Home</button>
  </div>
</template>

<script>
import "cesium/Build/Cesium/Widgets/widgets.css";
import * as Cesium from "cesium";
window.Cesium = Cesium;
export default {
  name: "CesiumMap",
  props: {},
  data() {
    return {
      viewer: null,
    };
  },
  mounted() {
    this.initCesium();
  },
  beforeDestroy() {
    if (this.viewer) {
      this.viewer.destroy();
      this.viewer = null;
    }
  },
  methods: {
    initCesium() {
      new Promise(async (resolve, reject) => {
        this.viewer = new Cesium.Viewer(this.$refs.cesiumContainer, {
          selectionIndicator: false,
          infoBox: false,
          contextOptions: {
            // 硬件反走样,默认值为 1
            msaaLevel: 8,
            requestWebgl2: true,
          },
          animation: false,
          timeline: false, // 底部时间线
          fullscreenButton: false, // 全屏
          vrButton: false, // VR
          sceneModePicker: false, // 选择视角的模式(球体、平铺、斜视平铺)
          baseLayerPicker: false, // 图层选择器(地形影像服务)
          navigationHelpButton: false, // 导航帮助(手势,鼠标)
          geocoder: false, // 位置查找工具
          homeButton: false, // 视角返回初始位置
        });
        this.viewer.scene.globe.baseColor = Cesium.Color.BLACK; // 设置地球颜色
        this.viewer.cesiumWidget.creditContainer.style.display = "none"; // 去除logo
        window.viewer = this.viewer;
        // viewer.imageryLayers.addImageryProvider(
        //   new Cesium.UrlTemplateImageryProvider({
        //     url: "http://webrd01.is.autonavi.com/appmaptile?&scale=1&lang=zh_cn&style=8&x={x}&y={y}&z={z}",
        //     minimumLevel: 1,
        //     maximumLevel: 18,
        //     crs: "WGS84", // 使用84坐标系,默认为:GCJ02
        //   })
        // );
        /* 
      **
       //卫片 " http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",   
       //路网" https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=11"   
       //地名" https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=4"
       //地名+路网 " http://webst01.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}",
       //矢量切片风格 " http://webrd01.is.autonavi.com/appmaptile?&scale=1&lang=zh_cn&style=8&x={x}&y={y}&z={z}",
      */
        // const imageryLayer = new Cesium.ImageryLayer(
        //   new Cesium.UrlTemplateImageryProvider({
        //     url: "http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
        //     minimumLevel: 1,
        //     maximumLevel: 18,
        //     crs: "WGS84", // 使用84坐标系,默认为:GCJ02
        //   })
        // );
        // viewer.imageryLayers.add(imageryLayer); //添加卫片
        // const imageryLayer2 = new Cesium.ImageryLayer(
        //   new Cesium.UrlTemplateImageryProvider({
        //     url: "https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=11",
        //     minimumLevel: 1,
        //     maximumLevel: 18,
        //     crs: "WGS84", // 使用84坐标系,默认为:GCJ02
        //   })
        // );
        // viewer.imageryLayers.add(imageryLayer2); ///添加路网
        // const imageryLayer3 = new Cesium.ImageryLayer(
        //   new Cesium.UrlTemplateImageryProvider({
        //     url: "https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=4",
        //     minimumLevel: 1,
        //     maximumLevel: 18,
        //     crs: "WGS84", // 使用84坐标系,默认为:GCJ02
        //   })
        // );
        // viewer.imageryLayers.add(imageryLayer3); //添加地名
        // //矢量底图
        // viewer.imageryLayers.addImageryProvider(
        //   new Cesium.WebMapTileServiceImageryProvider({
        //     url: "http://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=d6a72a78a43a2c17294b72ab26354cd6",
        //     layer: "tdtImgBasicLayer",
        //     style: "default",
        //     format: "image/jpeg",
        //     tileMatrixSetID: "GoogleMapsCompatible",
        //     show: false,
        //     // maximumLevel: 18
        //   })
        // );
        // //中文地名注记
        // viewer.imageryLayers.addImageryProvider(
        //   new Cesium.WebMapTileServiceImageryProvider({
        //     url: "http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=d6a72a78a43a2c17294b72ab26354cd6",
        //     layer: "tdtAnnoLayer",
        //     style: "default",
        //     format: "tiles",
        //     tileMatrixSetID: "GoogleMapsCompatible",
        //     show: true,
        //   })
        // );
        // viewer.imageryLayers.addImageryProvider(
        //   new Cesium.WebMapTileServiceImageryProvider({
        //     url:
        //       "http://{s}.tianditu.gov.cn/cia_c/wmts?service=wmts&request=GetTile&version=1.0.0" +
        //       "&LAYER=cia&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" +
        //       "&style=default&format=tiles&tk=175171c959b6f72e789fb3c45a266d55",
        //     layer: "tdtCva",
        //     style: "default",
        //     format: "tiles",
        //     tileMatrixSetID: "c",
        //     subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
        //     tilingScheme: new Cesium.GeographicTilingScheme(),
        //     tileMatrixLabels: [
        //       "1",
        //       "2",
        //       "3",
        //       "4",
        //       "5",
        //       "6",
        //       "7",
        //       "8",
        //       "9",
        //       "10",
        //       "11",
        //       "12",
        //       "13",
        //       "14",
        //       "15",
        //       "16",
        //       "17",
        //       "18",
        //       "19",
        //     ],
        //     maximumLevel: 18,
        //   })
        // );
        let imgLayer = new Cesium.UrlTemplateImageryProvider({
          url: "SameUrlPath/{z}/{x}/{y}.png",
          layer: "imgLayer",
          minimumLevel: 1,
          maximumLevel:10,
        });
        viewer.imageryLayers.addImageryProvider(imgLayer);
        // viewer.camera.setView({
        //   destination: Cesium.Cartesian3.fromDegrees(113, 34, 15000.0),
        //   orientation: {
        //     heading: Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
        //     pitch: Cesium.Math.toRadians(-90), // default value (looking down)
        //     roll: 0.0, // default value
        //   },
        // });
        ///
        // 加载地形数据
        viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
          url: "https://[ t0-t7 ].tianditu.gov.cn/mapservice/swdx?tk=175171c959b6f72e789fb3c45a266d55", //"data/sjzTerrain/", //"http://192.168.1.143:8963/",// Cesium.IonResource.fromAssetId(1), //"http://192.168.1.143:8963/"
          requestWaterMask: true, // 控制水的流动效果
          requestVertexNormals: true, //请求地形照明数据
        });
        viewer.scene.globe.enableLighting = true;
        const positions = [
          Cesium.Cartographic.fromDegrees(
            114.22268842439114,
            38.134979272096594
          ),
          Cesium.Cartographic.fromDegrees(114.5199580178976, 38.1139391070047),
        ];
        const updatedPositions = await Cesium.sampleTerrainMostDetailed(
          viewer.terrainProvider,
          positions
        );
        console.log(`updatedPositions`, updatedPositions);
        try {
          const updatedPositions2 = await Cesium.sampleTerrainMostDetailed(
            viewer.terrainProvider,
            positions,
            true
          );
          console.log(`updatedPositions2`, updatedPositions2);
        } catch (error) {
          // A tile request error occurred.
        }

        const updatedPositions3 = await Cesium.sampleTerrain(
          viewer.terrainProvider,
          10,
          positions
        );
        console.log(`updatedPositions3`, updatedPositions3);
        try {
          const updatedPositions4 = await Cesium.sampleTerrain(
            viewer.terrainProvider,
            10,
            positions,
            true
          );
          console.log(`updatedPositions4`, updatedPositions4);
        } catch (error) {
          // A tile request error occurred.
        }
        // 测试数据
        // 114.22268842439114 38.134979272096594
        // 114.5199580178976 38.1139391070047
        // 114.24207825088216 37.91371829614106
        // 114.56477609722275 37.908966850537524

        /
        // viewer.camera.flyTo({
        //   destination: Cesium.Cartesian3.fromDegrees(
        //     114.517971,
        //     38.054466,
        //     150000.0
        //   ),
        //   orientation: {
        //     heading: Cesium.Math.toRadians(0.0), // east, default value is 0.0 (north)
        //     pitch: Cesium.Math.toRadians(-90), // default value (looking down)
        //     roll: 0.0, // default value
        //   },
        //   duration: 2,
        // });
        resolve(viewer);
      }).then(() => {
        /
        let LogLatHeight = [];
        let LogLat = [];
        /
        let handler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        );
        handler.setInputAction((movement) => {
          let ray = this.viewer.camera.getPickRay(movement.position);
          if (!ray) return null;
          let position = this.viewer.scene.globe.pick(ray, this.viewer.scene);
          if (position) {
            console.log(`movement`, movement);
            // console.log(`movement.position`, movement.position);
            console.log(`position`, position);
            let cartograhic =
              Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);
            console.log(`cartograhic`, cartograhic);
            let log = Cesium.Math.toDegrees(cartograhic.longitude);
            let lat = Cesium.Math.toDegrees(cartograhic.latitude);
            let height = cartograhic.height;
            console.log(`log,lat,height`, log, lat, height);
            LogLatHeight.push(log, lat, height);
            console.log(`LogLatHeight`, LogLatHeight);
            LogLat.push(log, lat, 0);
            console.log(`LogLat`, LogLat);
          }
        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
        // this.DrawPointFun();
        // this.DrawPolylineFun();
        // this.DrawPolygonFun();
        // this.DrawLabelFun();
        // this.DrawBillboardFun();
        // // this.DrawGeoJsonFun();
        // // this.DrawKMLFun();
        // this.DrawCesium3DTileFun();
      });
    },
    HomeFun() {
      viewer.camera.flyHome();
    },
    DrawPointFun() {
      const dataSource = new Cesium.CustomDataSource("myPointData");
      viewer.dataSources.add(dataSource);
      let PointData = {
        position: Cesium.Cartesian3.fromDegrees(116.1, 34, 0),
        point: {
          color: Cesium.Color.RED,
          outlineColor: Cesium.Color.YELLOW,
          outlineWidth: 5,
          pixelSize: 30,
          //scaleByDistance: true,
        },
      };
      const entity = dataSource.entities.add(PointData);
    },
    DrawPolylineFun() {
      const dataSource = new Cesium.CustomDataSource("myPolylineData");
      viewer.dataSources.add(dataSource);
      const PolylineData = {
        name: "Red dashed line",
        polyline: {
          positions: Cesium.Cartesian3.fromDegreesArrayHeights([
            113, 34, 0, 116, 34, 0,
          ]),
          width: 25,
          // material:  new Cesium.PolylineOutlineMaterialProperty({
          //   color:Cesium.Color.RED,
          //   outlineColor:Cesium.Color.YELLOW,
          //   outlineWidth:10
          // }),
          material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.RED),
          // material: new Cesium.PolylineDashMaterialProperty({
          //   color: Cesium.Color.RED,
          // }),
        },
      };
      const entity = dataSource.entities.add(PolylineData);
    },
    DrawPolygonFun() {
      const dataSource = new Cesium.CustomDataSource("myPolylineData");
      viewer.dataSources.add(dataSource);
      let PolygonData = {
        name: "Red polygon on surface",
        polygon: {
          hierarchy: Cesium.Cartesian3.fromDegreesArray([
            115.0, 34.0, 115.0, 34.0, 115.1, 33.9, 115.0, 33.6, 115.6, 33.5,
          ]),
          material: Cesium.Color.RED,
        },
      };
      const entity = dataSource.entities.add(PolygonData);
    },
    DrawLabelFun() {
      const dataSource = new Cesium.CustomDataSource("myLabelData");
      viewer.dataSources.add(dataSource);
      Cesium.Label.enableRightToLeftDetection = true;
      let LabelData = {
        position: Cesium.Cartesian3.fromDegrees(116, 34.1522222),
        label: {
          text: "Philadelphia",
          font: "24px Helvetica",
          fillColor: Cesium.Color.SKYBLUE,
          outlineColor: Cesium.Color.BLACK,
          outlineWidth: 2,
          style: Cesium.LabelStyle.FILL_AND_OUTLINE,
        },
      };
      dataSource.entities.add(LabelData);
    },
    DrawBillboardFun() {
      const dataSource = new Cesium.CustomDataSource("myBillboardData");
      viewer.dataSources.add(dataSource);
      let BillboardData = {
        position: Cesium.Cartesian3.fromDegrees(115.5, 34.1522222),
        billboard: {
          image: require("@/assets/logo.png"),
          show: true, // default
          pixelOffset: new Cesium.Cartesian2(0, 0), // default: (0, 0)
          eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0), // default
          horizontalOrigin: Cesium.HorizontalOrigin.CENTER, // default
          verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // default: CENTER
          scale: 2.0, // default: 1.0
          color: Cesium.Color.LIME, // default: WHITE
          //rotation: Cesium.Math.PI_OVER_FOUR, // default: 0.0
          alignedAxis: Cesium.Cartesian3.ZERO, // default
          width: 200, // default: undefined
          height: 200, // default: undefined
        },
        label: {
          text: "标牌、点",
          font: "24px Helvetica",
          fillColor: Cesium.Color.RED,
          outlineColor: Cesium.Color.BLACK,
          outlineWidth: 2,
          style: Cesium.LabelStyle.FILL_AND_OUTLINE,
          showBackground: true,
          backgroundColor: new Cesium.Color(0.165, 0.165, 0.165, 0.8),
          backgroundPadding: new Cesium.Cartesian2(7, 5),
          pixelOffset: new Cesium.Cartesian2(0, 50), // default: (0, 0)
          eyeOffset: new Cesium.Cartesian3(0.0, 0.0, -10.0), // default
        },
        point: {
          color: Cesium.Color.fromCssColorString("#ff0000").withAlpha(0.6),
          outlineColor: Cesium.Color.YELLOW,
          outlineWidth: 5,
          pixelSize: 30,
          //scaleByDistance: true,
        },
      };
      let entity = dataSource.entities.add(BillboardData);
      //viewer.zoomTo(entity);
    },
    DrawGeoJsonFun() {
      var promise = Cesium.GeoJsonDataSource.load(
        require("./data/hbeiprovince.json")
      );
      promise.then((datasource) => {
        viewer.dataSources.add(datasource);
        datasource.entities.values.forEach((enetity) => {
          console.log(enetity);
          enetity.polygon.outlineColor = Cesium.Color.RED;
          enetity.polygon.material = Cesium.Color.BLUE;
          enetity.polygon.height = 1000;
          enetity.polygon.extrudedHeight = 2000;
        });
        //viewer.zoomTo(datasource);
      });
    },
    DrawKMLFun() {
      var promise = Cesium.KmlDataSource.load("data/test.kml", {
        camera: viewer.scene.camera,
        canvas: viewer.scene.canvas,
      });
      promise.then((datasource) => {
        viewer.dataSources.add(datasource);
        //viewer.zoomTo(datasource);
        datasource.entities.values.forEach((enetity) => {
          enetity.polygon.outlineColor =
            Cesium.Color.fromCssColorString("#ffADDF");
          enetity.polygon.material = Cesium.Color.fromCssColorString("#67ff0F");
          enetity.polygon.height = 1000;
          enetity.polygon.extrudedHeight = 2000;
        });
      });
    },
    async DrawCesium3DTileFun() {
      // try {
      //   const tileset =await Cesium.Cesium3DTileset.fromUrl("data/test3dtiles/tileset.json")// await Cesium.Cesium3DTileset.fromIonAssetId(75343);
      //   viewer.scene.primitives.add(tileset);
      //   viewer.zoomTo(tileset);
      // } catch (error) {
      //   console.log(`Error loading tileset: ${error}`);
      // }
      // viewer.scene.globe.depthTestAgainstTerrain = true;

      /
      const tilesetOption = {
        skipLevelOfDetail: true,
        baseScreenSpaceError: 1024,
        skipScreenSpaceErrorFactor: 16,
        skipLevels: 1,
        immediatelyLoadDesiredLevelOfDetail: false,
        loadSiblings: false,
        cullWithChildrenBounds: true,
      };
      const modelPromise = this.AddThreeDTiles(
        "data/test3dtiles/tileset.json",
        tilesetOption
      ); // 模型切瓦后的瓦片索引文件URL
      //const modelPromise = this.AddThreeDTiles(69380); // Cesium Ion Resource
      modelPromise.then((tileset) => {
        console.log("tileset: ", tileset);
        viewer.zoomTo(tileset);
      });
    },
    async AddThreeDTiles(url, option) {
      viewer.scene.globe.depthTestAgainstTerrain = true;
      // ! 写法二:
      let tileset = {};
      if (typeof url == "number") {
        tileset = await Cesium.Cesium3DTileset.fromIonAssetId(url, option);
      } else {
        tileset = await Cesium.Cesium3DTileset.fromUrl(url, option);
      }
      viewer.scene.primitives.add(tileset);
      return tileset; // 返回模型对象
    },
    LoadLocalMapUrl() {
      // viewer.imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
      //       url: "./notes/{z}/{x}/{y}.png",
      //           minimumLevel: 0,
      //           maximumLevel: 11,
      //           rectangle:new  Cesium.Rectangle(Cesium.Math.toRadians(114.32), Cesium.Math.toRadians(36.927),
      //           Cesium.Math.toRadians(114.524), Cesium.Math.toRadians(37.22))
      //   }))
    },
  },
};
</script>
<style lang="scss" scoped>
.CesiumOutbox {
  width: 100%;
  height: 100%;
  position: relative;
  .cesiumContainerbox {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  .Btnbox {
    position: absolute;
    top: 15px;
    left: 15px;
    cursor: pointer;
  }
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1404905.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

macos pip3 install pycryptodome导入from Crypto.Cipher import AES报错

问题&#xff1a; 已经使用pip3 install pycryptodome安装成功了&#xff0c;但是导入from Crypto.Cipher import AES还是提示Unresolved reference Crypto 原因&#xff1a; 一句话&#xff1a;安装文件大小写问题&#xff08;这只是我遇到的一种情况&#xff09;。 修改&am…

牛客周赛 Round 18 解题报告 | 珂学家 | 分类讨论计数 + 状态DP

前言 整体评价 前三题蛮简单的&#xff0c;T4是一个带状态的DP&#xff0c;这题如果用背包思路去解&#xff0c;不知道如何搞&#xff0c;感觉有点头痛。所以最后还是选择状态DP来求解。 欢迎关注 珂朵莉 牛客周赛专栏 珂朵莉 牛客小白月赛专栏 A. 游游的整数翻转 这题最好…

03.Elasticsearch应用(三)

Elasticsearch应用&#xff08;三&#xff09; 1.核心概念介绍 注意&#xff1a;类型&#xff08;Type&#xff09; 6.0之前的版本有Type概念&#xff0c;type相当于关系型数据库的表&#xff0c;ES官方将在ES9版本中彻底删除Type。7里面Type为ES默认的类型_doc 2.Cat API 介…

面试经典 150 题 - 多数元素

多数元素 给定一个大小为 n 的数组 nums &#xff0c;返回其中的多数元素。多数元素是指在数组中出现次数 大于 ⌊ n/2 ⌋ 的元素。 你可以假设数组是非空的&#xff0c;并且给定的数组总是存在多数元素。 示例 1&#xff1a; 输入&#xff1a;nums [3,2,3] 输出&#xff1…

Ubutu下的Shell操作

前言 在学习Ubuntu系统时&#xff0c;Shell操作是必不可少的知识。本篇文章是记录我学习Linux系统时&#xff0c;Ubutu下的Shell操作&#xff0c;希望我的分享对大家有所帮助&#xff01; 目录 前言 一、什么时是Shell 二、Shell的基本操作 三、常用的Shell命令 1、目录信…

C++提高编程——STL:string容器、vector容器

本专栏记录C学习过程包括C基础以及数据结构和算法&#xff0c;其中第一部分计划时间一个月&#xff0c;主要跟着黑马视频教程&#xff0c;学习路线如下&#xff0c;不定时更新&#xff0c;欢迎关注。 当前章节处于&#xff1a; ---------第1阶段-C基础入门 ---------第2阶段实战…

机器学习:什么是监督学习和无监督学习

目录 一、监督学习 &#xff08;一&#xff09;回归 &#xff08;二&#xff09;分类 二、无监督学习 聚类 一、监督学习 介绍&#xff1a;监督学习是指学习输入到输出&#xff08;x->y&#xff09;映射的机器学习算法&#xff0c;监督即理解为&#xff1a;已知正确答案…

React三大属性

我是南城余&#xff01;阿里云开发者平台专家博士证书获得者&#xff01; 欢迎关注我的博客&#xff01;一同成长&#xff01; 一名从事运维开发的worker&#xff0c;记录分享学习。 专注于AI&#xff0c;运维开发&#xff0c;windows Linux 系统领域的分享&#xff01; 知…

【C++修行之道】STL(初识pair、vector)

目录 一、pair 1.1pair的定义和结构 1.2pair的嵌套 1.3pair自带排序规则 1.4代码示例 二、vector 2.1vector的定义和特性 2.2vector的初始化 一维初始化&#xff1a; 2.3vector的常用函数 2.4vector排序去重 排序: 去重&#xff1a; 示例&#xff1a; 一、pair …

Redis(六)

1、Redis的缓存淘汰策略 1.1、内存配置 首先查看Redis最大的占用内存&#xff0c;打开redis配置文件&#xff0c;设置maxmemory参数&#xff0c;maxmemory是bytes字节类型&#xff0c;注意转换。 打开配置文件发现没有配置&#xff0c;那么默认是多少的内存&#xff0c;是这样…

[pytorch入门] 3. torchvision中的transforms

torchvision中的transforms 是transforms.py工具箱&#xff0c;含有totensor、resize等工具 用于将特定格式的图片转换为想要的图片的结果&#xff0c;即用于图片变换 用法 在transforms中选择一个类创建对象&#xff0c;使用这个对象选择相应方法进行处理 能够选择的类 列…

MAXWELL

MAXWELL 一、maxwell是什么 maxwell 官网地址&#xff1a;http://maxwells-daemon.io/ 因为官网是纯英文的&#xff0c;倒是不难懂&#xff0c;但总觉得写的略粗糙&#xff08;也可能笔者英文水平确实拉胯&#xff0c;有待提高&#xff09;。所以还是自己百度了一下。 当my…

实战:加密传输数据解密

前言 下面将分享一些实际的渗透测试经验&#xff0c;帮助你应对在测试中遇到的数据包内容加密的情况。我们将以实战为主&#xff0c;技巧为辅&#xff0c;进入逆向的大门。 技巧 开局先讲一下技巧&#xff0c;掌握好了技巧&#xff0c;方便逆向的时候可以更加快速的找到关键…

hpa自动伸缩

1、定义&#xff1a;hpa全称horizontal pod autoscaling&#xff08;pod的水平自动伸缩&#xff09;&#xff0c;这是k8s自带的模块。pod占用CPU的比率到达一定阀值会触发伸缩机制&#xff08;根据CPU使用率自动伸缩&#xff09; replication controller副本控制器&#xff0c…

TortoiseSVN源码安装与迁移全攻略

一、前言 随着版本控制系统的普及&#xff0c;越来越多的开发者和团队开始使用SVN&#xff08;Subversion&#xff09;来管理代码。本文将详细介绍TortoiseSVN的源码安装及迁移过程&#xff0c;帮助您轻松掌握这一版本控制工具。 二、TortoiseSVN源码安装 依赖环境安装&…

写给不耐烦程序员的 JavaScript 指南(五)

第七部分&#xff1a;集合 原文&#xff1a;exploringjs.com/impatient-js/pt_collections.html 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 下一步&#xff1a;30 同步迭代 三十、同步迭代 原文&#xff1a;exploringjs.com/impatient-js/ch_sync-iteration.htm…

SRC实战 | EDU通用漏洞分享

又是没事干的一天&#xff0c;写一下之前挖的两个通用漏洞。 1.信息搜集 首先就是信息搜集&#xff0c;挖edu没账号怎么办呢&#xff1f;sg不行&#xff0c;咱就找能自己注册的站。 Hunter&#xff1a;web.title”XX大学”&&web.body”注册” Fofa&#xff1a;host”…

11-数组-二维区域和检索 - 矩阵不可变

这是数组的第11篇算法&#xff0c;力扣链接。 给定一个二维矩阵 matrix&#xff0c;以下类型的多个请求&#xff1a; 计算其子矩形范围内元素的总和&#xff0c;该子矩阵的 左上角 为 (row1, col1) &#xff0c;右下角 为 (row2, col2) 。 实现 NumMatrix 类&#xff1a; NumMa…

低代码开发中的Nacos配置:跨平台跳转的解决方案

在当今低代码开发的时代&#xff0c;平台的易用性和灵活性非常重要。右上角平台跳转作为用户界面中常见的交互元素&#xff0c;对于提高用户体验具有举足轻重的地位。然而&#xff0c;有时候我们会遇到跳转失效的情况&#xff0c;这无疑给用户带来了困扰。本文以JVS低代码平台为…

谷歌 2024 新年目标曝光:一边做地表最强 AI,一边裁更多员工丨 RTE 开发者日报 Vol.132

开发者朋友们大家好&#xff1a; 这里是 「RTE 开发者日报」 &#xff0c;每天和大家一起看新闻、聊八卦。我们的社区编辑团队会整理分享 RTE &#xff08;Real Time Engagement&#xff09; 领域内「有话题的 新闻 」、「有态度的 观点 」、「有意思的 数据 」、「有思考的 文…