uniapp使用openlayers加载地图服务

uniapp使用openlayers加载地图服务

<!-- 地图组件 -->
<template><view id="myMap" :regionChangeItem="regionChangeItem" :change:regionChangeItem="olRender.selectAdministrativeRegion":tagSelectProduce=tagSelectProduce :tagSelectDistribute="tagSelectDistribute":change:tagSelectProduce="olRender.tagSelectChangeProduce":change:tagSelectDistribute="olRender.tagSelectChangeDistribute" :dropFrameDataProduce="dropFrameDataProduce":dropFrameDataDistribute="dropFrameDataDistribute" :change:dropFrameDataProduce="olRender.loadDropFrameProduce":change:dropFrameDataDistribute="olRender.loadDropFrameDistribute"style="width: 100%; height: calc(100vh - 84rpx);"></view>
</template><script>export default {props: {// 行政区选择数据regionChangeItem: {type: Object,default: () => ({geom: null,})},dropFrameDataProduce: {type: Object,default: () => ({imagesGeom05: [],imagesGeom1: [],imagesGeom2: [],xzqdm: 530000,})},dropFrameDataDistribute: {type: Object,default: () => ({imagesGeom05: [],imagesGeom1: [],imagesGeom2: [],xzqdm: 530000,})},tagSelectProduce: {type: Object,default: () => ({tag05: true,tag1: true,tag2: true,})},tagSelectDistribute: {type: Object,default: () => ({tag05: true,tag1: true,tag2: true,})},},}
</script><script module="olRender" lang="renderjs">import source, {Vector as sourceVector} from 'ol/source';import ol, {Map,Tile,View,Feature} from 'ol';import {Polygon} from 'ol/geom';import {Style,Fill,Stroke} from 'ol/style';import {fromLonLat,transform,Projection} from 'ol/proj.js';import {DragPan,MouseWheelZoom,defaults as defaultInteractions} from 'ol/interaction';import {Vector,} from 'ol/layer';import VectorImageLayer from 'ol/layer/Vector';import VectorSource from 'ol/source/Vector';import WKT from 'ol/format/WKT';import GeoJSON from "ol/format/GeoJSON";import {bbox as bboxStrategy} from 'ol/loadingstrategy';import {MapServiceLoader} from '@/map/MapServiceLoader.js';import GLOBAL_VARIABLE from '@/public/config/GlobalConfig';import {eventBus} from '@/utils/eventBus.js';export default {data() {return {mapId: 'myMap',map: null,mapServiceLoader: null,format: new WKT(),xzqId: 'xzq', // 行政区idxzqIdYns: 'xzqYns', // 行政区id(省)xzqHighlightId: 'xzqHighlight', // 选择后高亮行政区idprojection: {},dropColor: {imagesGeom05: {strokeColor: 'rgba(175, 175, 175, 0.5)',fillColor: 'rgba(147, 250, 194, 0.5)',},imagesGeom1: {strokeColor: 'rgba(175, 175, 175, 0.5)',fillColor: 'rgba(147, 240, 250, 0.5)',},imagesGeom2: {strokeColor: 'rgba(175, 175, 175, 0.5)',fillColor: 'rgba(255, 196, 196, 0.5)',},},dropColorDistribute: {imagesGeom05: {strokeColor: 'rgba(152, 230, 0, 0.5)',fillColor: 'rgba(76, 230, 0, 0.5)',},imagesGeom1: {strokeColor: 'rgba(152, 230, 0, 0.5)',fillColor: 'rgba(152, 230, 0, 0.5)',},imagesGeom2: {strokeColor: 'rgba(230, 230, 0, 0.5)',fillColor: 'rgba(230, 230, 0, 0.5)',},},// 影像生产-落图框图层iddrop05ProduceId: 'drop05_p',drop1ProduceId: 'drop1_p',drop2ProduceId: 'drop2_p',// 影像分发-落图框图层iddrop05DistributeId: 'drop05_d',drop1DistributeId: 'drop1_d',drop2DistributeId: 'drop2_d',// 影像生产落图框图层imagesGeom05LayersProduce: null,imagesGeom1LayersProduce: null,imagesGeom2LayersProduce: null,// 影像分发-落图框图层imagesGeom05LayersDistribute: null,imagesGeom1LayersDistribute: null,imagesGeom2LayersDistribute: null,};},methods: {getRegionLayerDataCounty(cqlFilter = 'level in (2)') {const workspaceName = GLOBAL_VARIABLE.administrativeConfig.workspaceName;const layerName = GLOBAL_VARIABLE.administrativeConfig.layerNameCounty;const accessUrl = GLOBAL_VARIABLE.administrativeConfig.accessUrl;const optionWms = {layerName,matrixSet: 'EPSG:4326',accessUrl: `${accessUrl}/${workspaceName}/wms`,id: this.xzqId,serviceType: 'wms',otherPara: {layerName: layerName,matrixSet: 'EPSG:4326',format: 'image/png',VERSION: '1.1.1',LAYERS: workspaceName + ':' + layerName,projection: this.projection,zIndex: 10,opacity: 1,exceptions: 'application/vnd.ogc.se_inimage',CQL_FILTER: cqlFilter,},transformationMatrix: '1,2,3 2,4,5 4,6,7',};const optionWmTs = {layerName,matrixSet: 'EPSG:4326',accessUrl: `${accessUrl}/${workspaceName}/gwc/service/wmts?request=GetCapabilities`,id: this.xzqId,serviceType: 'wmts',transformationMatrix: '1,2,3 2,4,5 4,6,7',otherPara: {}};return optionWmTs;},innitMap() {const projection = new Projection({code: 'EPSG:4490',units: 'degrees',global: false,});this.projection = projection;const view = new View({projection,enableRotation: false, // 禁止地图旋转})const map = new Map({target: this.mapId,layers: [],view,controls: [],interactions: defaultInteractions({dragPan: false,doubleClickZoom: false, // 取消双击放大功能交互mouseWheelZoom: false, // 取消滚动鼠标中间的滑轮交互shiftDragZoom: false, // 取消shift+wheel左键拖动交互}).extend([new DragPan({condition: function(event) {return event.originalEvent.button === 1;}})]),});// 拖拽移动// const dragPan = new DragPan();// const mouseWheelZoom = new MouseWheelZoom();// // 添加DragPan和MouseWheelZoom交互到地图// map.addInteraction(dragPan);// map.addInteraction(mouseWheelZoom);// 禁用地图旋转view.setRotation(0);this.map = map;this.mapServiceLoader = new MapServiceLoader(map);// 加载行政区this.mapServiceLoader.loadServices(this.getRegionLayerDataCounty());// this.xzqLoadLocal();this.map.on('click', (e) => {this.handleMapClick(e);})// 定位到行政区this.goToXzqLayer();},/*** 影像生产-落图框显示标签改变*/tagSelectChangeProduce(e) {this.imagesGeom05LayersProduce && this.imagesGeom05LayersProduce.setVisible(e.tag05);this.imagesGeom1LayersProduce && this.imagesGeom1LayersProduce.setVisible(e.tag1);this.imagesGeom2LayersProduce && this.imagesGeom2LayersProduce.setVisible(e.tag2);},/*** 影像分发-落图框显示标签改变*/tagSelectChangeDistribute(e) {this.imagesGeom05LayersDistribute && this.imagesGeom05LayersDistribute.setVisible(e.tag05);this.imagesGeom1LayersDistribute && this.imagesGeom1LayersDistribute.setVisible(e.tag1);this.imagesGeom2LayersDistribute && this.imagesGeom2LayersDistribute.setVisible(e.tag2);},/*** 影像分发-加载落图框*/loadDropFrameDistribute({imagesGeom05,imagesGeom1,imagesGeom2,xzqdm,}) {const wktFormat = this.format;const that = this;// 移除之前的高亮图层if (this.mapServiceLoader) {this.mapServiceLoader.removeLayerBiyId(this.drop05DistributeId);this.mapServiceLoader.removeLayerBiyId(this.drop1DistributeId);this.mapServiceLoader.removeLayerBiyId(this.drop2DistributeId);}this.imagesGeom05LayersDistribute = null;this.imagesGeom1LayersDistribute = null;this.imagesGeom2LayersDistribute = null;if (imagesGeom05.length) {let features = [];imagesGeom05.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop05DistributeId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 300,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColorDistribute.imagesGeom05.fillColor,}),stroke: new Stroke({color: that.dropColorDistribute.imagesGeom05.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop05DistributeId;this.imagesGeom05LayersDistribute = vectorLayer;// vectorLayer.setVisible(false);this.map.addLayer(vectorLayer);}if (imagesGeom1.length) {let features = [];imagesGeom1.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop1DistributeId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 200,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColorDistribute.imagesGeom1.fillColor,}),stroke: new Stroke({color: that.dropColorDistribute.imagesGeom1.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop1DistributeId;this.imagesGeom1LayersDistribute = vectorLayer;// vectorLayer.setVisible(false);this.map.addLayer(vectorLayer);}if (imagesGeom2.length) {let features = [];imagesGeom2.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop2DistributeId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 100,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColorDistribute.imagesGeom2.fillColor,}),stroke: new Stroke({color: that.dropColorDistribute.imagesGeom2.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop2DistributeId;this.imagesGeom2LayersDistribute = vectorLayer;// vectorLayer.setVisible(false);this.map.addLayer(vectorLayer);}if (xzqdm == 530000) {const myset = setTimeout(function() {that.gotoDropLayers([this.drop05DistributeId, this.drop1DistributeId, this.drop2DistributeId]);clearTimeout(myset)}, 200);}},/*** 影像生产-加载图框*/loadDropFrameProduce({imagesGeom05,imagesGeom1,imagesGeom2,xzqdm,}) {const wktFormat = this.format;const that = this;// 移除之前的高亮图层if (this.mapServiceLoader) {this.mapServiceLoader.removeLayerBiyId(this.drop05ProduceId);this.mapServiceLoader.removeLayerBiyId(this.drop1ProduceId);this.mapServiceLoader.removeLayerBiyId(this.drop2ProduceId);}this.imagesGeom05LayersProduce = null;this.imagesGeom1LayersProduce = null;this.imagesGeom2LayersProduce = null;if (imagesGeom05.length) {let features = [];imagesGeom05.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop05ProduceId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 300,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColor.imagesGeom05.fillColor,}),stroke: new Stroke({color: that.dropColor.imagesGeom05.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop05ProduceId;this.imagesGeom05LayersProduce = vectorLayer;this.map.addLayer(vectorLayer);}if (imagesGeom1.length) {let features = [];imagesGeom1.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop1ProduceId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 200,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColor.imagesGeom1.fillColor,}),stroke: new Stroke({color: that.dropColor.imagesGeom1.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop1ProduceIdthis.imagesGeom1LayersProduce = vectorLayer;this.map.addLayer(vectorLayer);}if (imagesGeom2.length) {let features = [];imagesGeom2.forEach((geom) => {features = [...features, ...wktFormat.readFeatures(geom)];});features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: that.drop2ProduceId});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 100,style(feature) {let strokeWidth = 1;return new Style({fill: new Fill({color: that.dropColor.imagesGeom2.fillColor,}),stroke: new Stroke({color: that.dropColor.imagesGeom2.strokeColor,width: strokeWidth,}),});},});vectorLayer.id = this.drop2ProduceId;this.imagesGeom2LayersProduce = vectorLayer;this.map.addLayer(vectorLayer);}if (xzqdm == 530000) {const myset = setTimeout(function() {that.gotoDropLayers([this.drop05ProduceId, this.drop1ProduceId, this.drop2ProduceId]);clearTimeout(myset)}, 200);}},/**定位到行政区*/goToXzqLayer() {// console.log('定位到行政区');const extents = [97.52736740199998, 21.142140719999986, 106.19671131500002, 29.22577058899998];this.map.getView().fit(extents);},/*** 开关图层显示*/setLayerVisible(layerId, visible) {const layer = this.mapServiceLoader.findLayerById(this.xzqId);if (layer) {layer.setVisible(visible);}},/*** 根据id定位到图层*/positioningLayersById(layerId, isVisible = true) {const that = this;const layer = this.mapServiceLoader.findLayerById(layerId);if (layer) {const extents = layer.getSource().getExtent();this.map.getView().fit(extents, {duration: 1000});}const myset = setTimeout(function() {// 关闭主图that.setLayerVisible(that.xzqId, isVisible);clearTimeout(myset)}, 1000);},/*** 服务-切换地图到选择行政区上*/selectAtiveRegion({geom,xzqdm,children,}) {const that = this;// console.log('服务-切换地图到选择行政区上', xzqdm);const cqlFilter = `xzqdm = '${xzqdm}'`;// 加载行政区this.mapServiceLoader.loadServices(this.getRegionLayerDataCounty(cqlFilter));},/*** 定位到落图框*/gotoDropLayers(ids = [this.drop05ProduceId, this.drop1ProduceId, this.drop2ProduceId, this.drop05DistributeId,this.drop1DistributeId, this.drop2DistributeId]) {const allLayers = this.map.getLayers().getArray();let extents = [];allLayers.forEach((o, i) => {if (ids.includes(o['id'])) {extents = [...extents, ...o.getSource().getExtent()]}});if (extents.length) {this.map.getView().fit(extents, {duration: 500});} else {// 没有落图框,定位到行政区this.goToXzqLayer();}},/*** 行政区地图加载本地json*/xzqLoadLocal() {// 创建 GeoJSON 图层const geoJSONLayer = new VectorImageLayer({source: new VectorSource({url: "../../static/XZQ_2K.json",format: new GeoJSON()}),style: new Style({stroke: new Stroke({color: "#ff0000", // 描边红色width: 2 // 设置描边宽度为 1 像素}),fill: new Fill({color: "#ff000020" // 填充红色透明})})});console.log('geoJSONLayer', geoJSONLayer.getSource().getFeatures());geoJSONLayer.id = this.xzqId;geoJSONLayer.setVisible(false);this.map.addLayer(geoJSONLayer);},/*** 行政区geom-切换地图到选择行政区上*/selectAdministrativeRegion({geom,xzqdm,children,}) {const isYns = xzqdm == 530000;let isYnsTrue = null;if (this.mapServiceLoader) {// 省显示地图是否存在isYnsTrue = this.mapServiceLoader.layersIsTrueById(this.xzqIdYns);// 移除之前的高亮图层this.mapServiceLoader.removeLayerBiyId(this.xzqHighlightId);if (isYnsTrue) {this.mapServiceLoader.setVisibleById(this.xzqIdYns, isYns);}}if (!isYnsTrue || !isYns) {if (!geom) {return;}const wktFormat = this.format;let features = [];if (children && children.length) {children.forEach((c) => {features = [...features, ...wktFormat.readFeatures(c.geom)];});} else {features = wktFormat.readFeatures(geom);}features.forEach((f) => {f.setProperties({cLayerStyleType: 'type1',type: 'region'});});const vectorSource = new VectorSource({features: [...features],strategy: bboxStrategy});const vectorLayer = new VectorImageLayer({source: vectorSource,zIndex: 10,style(feature) {let strokeWidth = 2;return new Style({fill: new Fill({color: '#E1F0FF',}),stroke: new Stroke({color: '#FFFFFF',width: strokeWidth,}),});},});vectorLayer.id = isYns ? this.xzqIdYns : this.xzqHighlightId;// this.mapServiceLoader.setVisibleById(this.xzqIdYns, isYns);this.map.addLayer(vectorLayer);}// 	// 移除之前的高亮图层// 	// this.mapServiceLoader && this.mapServiceLoader.removeLayerBiyId(this.xzqHighlightId);// 	// this.setLayerVisible(this.xzqId, true);// 	// this.goToXzqLayer();// if (xzqdm === 530000) {// 	this.map// }// 定位到行政区this.positioningLayersById(this.xzqHighlightId, false);},/*** 影像点击事件* * @param {Object} event*/handleMapClick(event) {console.log('点击:', event, event.coordinate);},/*** 过滤行政区显示*/filterRegions() {console.log('过滤行政区显示')}},mounted() {this.innitMap();},onUnload() {// 移除地图实例this.map.dispose();}}
</script><style lang="scss" scoped>#myMap {padding: 0 $padding-base;margin-top: 30rpx;}
</style>

MapServiceLoader.js

import {Map
} from 'ol';
import {Tile as TileLayer,Vector as VectorLayer
} from 'ol/layer';
import {OSM,XYZ,Vector as VectorSource,ImageWMS,TileWMS,WMTS as sourceWMTS,
} from 'ol/source';
import {optionsFromCapabilities
} from 'ol/source/WMTS';
import {WMTS as tilegridWMTS
} from 'ol/tilegrid';import {get as getProjection
} from 'ol/proj';
import {WMTSCapabilities
} from 'ol/format';export class MapServiceLoader {map;wmtsOptionss = [];constructor(map) {this.map = map;}/*** 获取当前的地图*/getMap() {return this.map;}/*** 根据id查找图层*/findLayerById(id) {const layers = this.map.getLayers().getArray();// 使用自定义 id 属性查找图层return layers.find((layer) => layer.id === id);}/*** 根据id移除图层*/removeLayerBiyId(layerId = null) {if (layerId) {const layer = this.findLayerById(layerId);if (layer) {this.map.removeLayer(layer);}}}/*** 根据id显示或隐藏图层*/setVisibleById(layerId, isShow = true) {const layer = this.findLayerById(layerId);if (layer) {layer.setVisible(isShow);}}/*** 根据id判断图层是否存在*/layersIsTrueById(layerId) {let isTrue = false;const layer = this.findLayerById(layerId);if (layer) {isTrue = true;}return isTrue;}async getWMTSLayerConfig({layerName,matrixSet,accessUrl,serviceType,}) {const response = await fetch(accessUrl);const text = await response.text();const parser = new WMTSCapabilities();let wmtsCapabilities = parser.read(text);const options = optionsFromCapabilities(wmtsCapabilities, {layer: layerName,matrixSet,});this.wmtsOptionss.push({url: accessUrl,ops: wmtsCapabilities});return options;}/*** @param {Object} serviceConfigs* */async loadServices(serviceConfigs) {const {layerName,matrixSet,accessUrl,serviceType,otherPara,} = serviceConfigs;let layer = null;if (serviceType == 'wmts') {const options = await this.getWMTSLayerConfig(serviceConfigs);layer = new TileLayer({source: new sourceWMTS(options)})} else if (serviceType == 'wms') {console.log('otherPara', otherPara);const source = new TileWMS({url: accessUrl,params: {...otherPara},});layer = new TileLayer({source,});} else {console.error('serviceType类型错误')}this.removeLayerBiyId(serviceConfigs.id);console.log('layer', layer);layer.id = serviceConfigs.id;this.map.addLayer(layer);}
}

ol依赖放到跟目录
在这里插入图片描述

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

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

相关文章

Visual Studio 2022之Release版本程序发送到其它计算机运行

目录 1、缺少dll​ 2、应用程序无法正常启动 3、This application failed to start because no Qt platform plugin could be initialized. 代码在Debug模式下正常运行&#xff0c;然后切换到Release模式下&#xff0c;也正常运行&#xff0c;把第三方平台的dll拷贝到exe所在…

IPv6扩展头(四)——分片头

分片头部&#xff08;Fragment Header&#xff09;用于IPv6源节点向目的节点发送一个大于路径MTU的数据报。 一、优势 IPv6 分片头具有多种优势&#xff0c;可提高网络效率&#xff0c;包括减少数据包延迟和减少网络拥塞。使用 IPv6 分片头&#xff0c;数据包在源处而不是中间…

Uninty 鼠标点击(摄像机发出射线-检测位置)

平面来触发碰撞&#xff0c;胶囊用红色材质方便观察。 脚本挂载到胶囊上方便操作。 目前实现的功能&#xff0c;鼠标左键点击&#xff0c;胶囊就移动到那个位置上。 using System.Collections; using System.Collections.Generic; using UnityEngine;public class c6 : MonoBe…

数据结构-线段树

&#x1f4d1;前言 本文主要是【线段树】——线段树简单使用的文章&#xff0c;如果有什么需要改进的地方还请大佬指出⛺️ &#x1f3ac;作者简介&#xff1a;大家好&#xff0c;我是听风与他&#x1f947; ☁️博客首页&#xff1a;CSDN主页听风与他 &#x1f304;每日一句&…

PyCharm Community Edition 2023.3.3,UI界面设置成旧版

File->Settings->Appearance & Behavior->New UI->Enable new UI(取消勾选)->重启PyCharm 旧版UI: 新版UI&#xff1a;

对 JVM 的类加载机制以及寻找字节码文件的“双亲委派模型”的理解

目录 1、JVM 的类加载机制 1.1、加载 1.2、验证 1.3、准备 1.4、解析 1.5、初始化 2、双亲委派模型 2.1、工作过程 1、JVM 的类加载机制 类加载指的是 Java 进程运行的时候&#xff0c;需要把 .class 文件从硬盘读取到内存&#xff0c;并进行一系列的校验解析的过程。…

人民日报:用好“人工智能+” 赋能产业升级

以下文章来源&#xff1a;北京日报 文生视频、智能家居、智慧工厂……近年来&#xff0c;人工智能发展速度之快、应用范围之广备受瞩目。 政府工作报告提出&#xff0c;深化大数据、人工智能等研发应用&#xff0c;开展“人工智能”行动&#xff0c;打造具有国际竞争力的数字产…

力扣589、590、102、107、429、199、637、515、116、117、104、111、226、101-Java刷题笔记

一、589. N 叉树的前序遍历 - 力扣&#xff08;LeetCode&#xff09; 1.1题目 给定一个 n 叉树的根节点 root &#xff0c;返回 其节点值的 前序遍历 。 n 叉树 在输入中按层序遍历进行序列化表示&#xff0c;每组子节点由空值 null 分隔&#xff08;请参见示例&#xff09…

使用Python制作自己的wheel文件

平时自己利用Python制作一个个小工具后想分享给别人&#xff0c;但又嫌分享一堆项目代码很麻烦&#xff0c;那么你可以考虑将自己的项目打包成一个wheel文件&#xff0c;别人拿到文件后只需pip install安装即可使用&#xff0c;非常方便。 在上一篇博文中&#xff0c;利用nvid…

在maven多模块之间调用报错

错误信息为&#xff1a;不能解决maven_02_ssm项目的依赖问题&#xff0c;找不到maven_03_pojo这个jar包。 为什么找不到呢? 原因是Maven会从本地仓库找对应的jar包&#xff0c;但是本地仓库又不存在该jar包所以会报错。 在IDEA中是有maven_03_pojo这个项目&#xff0c;所以…

使用 Python 字典向 SQLite 插入数据

将Python字典数据插入SQLite数据库中其实有很多好处&#xff0c;例如使用字典的结构可以简化插入数据的代码&#xff0c;使其更加紧凑和易于理解。这降低了代码的复杂性&#xff0c;并使代码更易于维护。那么在我们日常使用中会有哪些问题呢&#xff1f;一起看看我是如何解决的…

华为配置DHCP Snooping防止DHCP Server仿冒者攻击示例

配置DHCP Snooping防止DHCP Server仿冒者攻击示例 组网图形 图1 配置DHCP Snooping防止DHCP Server仿冒者攻击组网图 DHCP Snooping简介配置注意事项组网需求配置思路操作步骤配置文件 DHCP Snooping简介 在一次DHCP客户端动态获取IP地址的过程中&#xff0c;DHCP Snoopi…

机器学习知识点复习 上(保研、复试、面试)百面机器学习笔记

机器学习知识点复习上 一、特征工程1. 为什么需要对数值类型的特征做归一化&#xff1f;2. 文本表示模型3. 图像数据不足的处理方法 二、模型评估1.常见的评估指标2.ROC曲线3.为什么在一些场景中要使用余弦相似度而不是欧氏距离&#xff1f;4.过拟合和欠拟合 三、经典算法1.支持…

✅ Windows11 系统 I 卡独显 A770 安装 深度学习 Pytorch 环境

&#x1f4cb; 文献参考 这里非常感谢知乎上的 ‘丢丢’ 的[**Windows系统下英特尔独显Pytorch的历程**] 为我提供了一开始的 I 卡安装想法&#xff01;但是文中并未介绍如何进行额外的环境变量操作问题&#xff0c;导致很多软件直接安装至系统盘&#xff0c;占用系统盘空间&am…

19.相机,棱镜和光场

一、成像方法 Imaging Synthesis Capture 1.Synthesis&#xff08;图形学上&#xff09;合成&#xff1a;比如之前学过的光线追踪或者光栅化 2.Capture&#xff08;捕捉&#xff09;&#xff1a;把真实世界存在的东西捕捉成为照片 二、相机 1.小孔成像 利用小孔成像的相…

【数据结构】矩阵的压缩存储

矩阵的压缩存储 5.1 普通矩阵的存储 用二维数组存储 分为行优先和列优先&#xff1a; 行优先&#xff1a;优先存放一行的数据。 列优先&#xff1a;优先存放一列的数据。 注意下标是从0还是1开始的&#xff01; 5.2 对称矩阵的存储 对称矩阵定义 若n阶方阵中任意一个元素 a i …

Sqoop “hcatalog does not exist!” 提示信息消除方法

sqoop运行的时候老是有这个报错提示&#xff0c;看着可烦&#xff0c;解决消除一下 解决方法&#xff1a; 1、在$SQOOP_HOME/bin目录下面修改configure-sqoop文件 1&#xff09;进文件夹 cd /training/sqoop-1.4.7/bin2&#xff09;编辑文件 vi /configure-sqoop3&#xff…

K8s Pod控制器

目录 前言&#xff1a; 1.Deployment 查看控制器配置 查看历史版本 2.SatefulSet 安装CoreDNS&#xff0c;仅二进制部署环境需要安装CoreDNS 方法一 方法二 查看statefulset的定义 清单定义StatefulSet 创建pv 定义PV 创建statefulset 滚动更新 总结 扩展伸缩…

【MySQL | 第三篇】MySQL索引及两种索引分类方法总结

文章目录 3.MySQL索引及两种索引分类方法3.1索引的概念3.1.1相关定义3.1.2查询例子 3.2索引的底层3.2.1二叉树&#xff08;1&#xff09;满二叉树&#xff08;2&#xff09;完全二叉树&#xff08;3&#xff09;二叉查找树&#xff08;4&#xff09;二叉平衡树&#xff08;AVL&…

HTML静态网页成品作业(HTML+CSS)——电影网首页网页设计制作(1个页面)

&#x1f389;不定期分享源码&#xff0c;关注不丢失哦 文章目录 一、作品介绍二、作品演示三、代码目录四、网站代码HTML部分代码 五、源码获取 一、作品介绍 &#x1f3f7;️本套采用HTMLCSS&#xff0c;未使用Javacsript代码&#xff0c;共有1个页面。 二、作品演示 三、代…