From fad21d94931ef4a021ca40f7d7e0466db0787014 Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Wed, 2 Nov 2022 11:09:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=B4=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 ++-- .../modules/visual/command/cpts/map-ol.vue | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.env.development b/.env.development index d1c8a3e7c..e6abb72d8 100644 --- a/.env.development +++ b/.env.development @@ -8,7 +8,7 @@ VUE_APP_API_SERVER = http://192.168.1.140/api # VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn:41080/api # VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn/api -# VUE_APP_NODE_ENV=dev_sdtdt -VUE_APP_NODE_ENV=dev +VUE_APP_NODE_ENV=dev_sdtdt +# VUE_APP_NODE_ENV=dev #项目根路径 VUE_APP_PUBLIC_PATH=epmet-oper \ No newline at end of file diff --git a/src/views/modules/visual/command/cpts/map-ol.vue b/src/views/modules/visual/command/cpts/map-ol.vue index 0959d17f8..df446bf40 100644 --- a/src/views/modules/visual/command/cpts/map-ol.vue +++ b/src/views/modules/visual/command/cpts/map-ol.vue @@ -456,9 +456,11 @@ export default { target: "map", }); - myMap.on("singleclick", function (e) { - // console.log(e.coordinate) - // console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); + myMap.on("singleclick", (event) => { + myMap.forEachFeatureAtPixel(event.pixel, function (feature) { + // 为移动到的 feature 发送自定义的 mousemove 消息 + feature.dispatchEvent({ type: "click", event }); + }); }); await nextTick(); @@ -535,6 +537,21 @@ export default { }), ]; + item.on("click", function (event) { + console.log("我被点击拉", item, event); + // 修改feature的样式为半径100像素的园,用蓝色填充 + this.setStyle( + new ol.style.Style({ + image: new ol.style.Circle({ + radius: 100, + fill: new ol.style.Fill({ + color: "blue", + }), + }), + }) + ); + }); + setInterval(() => { let currStyle = item.getStyle(); if (!Array.isArray(currStyle)) { From 2266ec09be37898c55a639c6b185db3444a44593 Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Wed, 2 Nov 2022 13:53:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- src/utils/dai-map.js | 6 ++-- src/utils/tdt-wp-zw.js | 6 ++-- src/views/modules/visual/command/index.vue | 5 +++- src/views/modules/workSys/mapConfig.vue | 33 +++++++++++----------- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/public/index.html b/public/index.html index 2e1d6b701..de763cc25 100644 --- a/public/index.html +++ b/public/index.html @@ -39,7 +39,7 @@ if (SITE_CONFIG['nodeEnv'] == 'dev_tdt') { toLoadJs('http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926') - } else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt') { + } else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt1') { toLoadJs('http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js') } else if (SITE_CONFIG['nodeEnv'] == 'yantai_zhengwu_prod') { toLoadJs('http://59.206.203.34/api/olapi/ol/openlayers.js') diff --git a/src/utils/dai-map.js b/src/utils/dai-map.js index 0edd0fa9c..f51a46780 100644 --- a/src/utils/dai-map.js +++ b/src/utils/dai-map.js @@ -16,7 +16,7 @@ const urlSdtdt = (() => { }; } else { return { - search: "http://172.20.46.177/epmet-map-proxy/QueryService.ashx", + search: "http://172.20.46.177/map_search_proxy/search", geo: "http://172.20.46.177/epmet-map-proxy/GeoDecodeService.ashx", }; } @@ -108,12 +108,12 @@ export function searchNearby(map, keyword) { const center = map.getCenter(); const url = urlSdtdt.search; const { status, result } = await requestGet(url, { - // area: `CIRCLE(${center.lon} ${center.lat} 1000000)`, + area: `CIRCLE(${center.lon} ${center.lat} 1000000)`, words: keyword, city: "烟台", uid: "navinfo", st: "LocalSearch", - // tk: "e758167d5b90c351b70a979c0820840c", + tk: "e758167d5b90c351b70a979c0820840c", }); if ( diff --git a/src/utils/tdt-wp-zw.js b/src/utils/tdt-wp-zw.js index 8e2c609cb..55c57cf1c 100644 --- a/src/utils/tdt-wp-zw.js +++ b/src/utils/tdt-wp-zw.js @@ -1,6 +1,8 @@ -export const baseUrl = "http://59.206.203.34/tileservice/SDPubMap"; +// let vec = +// "http://59.206.203.34/tileservice/SDPubMap?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=sdvec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={x}&TILECOL={y}&FORMAT=image%2Fpng"; + let vec = - "http://59.206.203.34/tileservice/SDPubMap?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=sdvec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={x}&TILECOL={y}&FORMAT=image%2Fpng"; + "http://172.20.46.177/map_tile_proxy/appmaptile?lang=zh_cn&style=7<ype=7&scl=0&size=0&x={x}&y={y}&z={z}"; if (window.SITE_CONFIG["nodeEnv"] == "dev_sdtdt") { vec = "http://service.sdmap.gov.cn/tileservice/sdpubmap?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=sdvec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={x}&TILECOL={y}&FORMAT=image%2Fpng&tk=e758167d5b90c351b70a979c0820840c"; diff --git a/src/views/modules/visual/command/index.vue b/src/views/modules/visual/command/index.vue index fd33754a7..4a08c4291 100644 --- a/src/views/modules/visual/command/index.vue +++ b/src/views/modules/visual/command/index.vue @@ -288,7 +288,10 @@ export default { People, cptCard, ScreenLoading, - gridMap: mapType == "tdzw" ? gridMapOl : gridMap, + gridMap: + mapType == "tdzw" && SITE_CONFIG["nodeEnv"] == "dev_sdtdt" + ? gridMapOl + : gridMap, sidemenu1, sidemenu2, sidemenuLeft, diff --git a/src/views/modules/workSys/mapConfig.vue b/src/views/modules/workSys/mapConfig.vue index 96f209a03..939b9e36b 100644 --- a/src/views/modules/workSys/mapConfig.vue +++ b/src/views/modules/workSys/mapConfig.vue @@ -647,27 +647,27 @@ const vueGis = { gaodeMapLayer = new TileLayer({ title: "地图", - source: new XYZ({ - url: "http://t4.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", - }), // source: new XYZ({ - // url: "http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926&x={x}&y={y}&l={z}" + // url: "http://t4.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", // }), // source: new XYZ({ - // //指定url瓦片 - // url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}', - // wrapX: true//x方向平铺,也可以选择false + // url: "http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926&x={x}&y={y}&l={z}" // }), + source: new XYZ({ + //指定url瓦片 + url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&style=7<ype=7&scl=0&size=0&x={x}&y={y}&z={z}", + wrapX: true, //x方向平铺,也可以选择false + }), // zIndex: 20 }); - var sourceMark = new XYZ({ - url: "http://t4.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", - // zIndex: 22 - }); - var tileMark = new TileLayer({ - title: "标注图层", - source: sourceMark, - }); + // var sourceMark = new XYZ({ + // url: "http://t4.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", + // // zIndex: 22 + // }); + // var tileMark = new TileLayer({ + // title: "标注图层", + // source: sourceMark, + // }); (mapView = new View({ //中心点坐标 @@ -680,7 +680,8 @@ const vueGis = { //初始化map和地图底图 //创建地图容器 (map = new Map({ - layers: [gaodeMapLayer, tileMark], + layers: [gaodeMapLayer], + // layers: [gaodeMapLayer, tileMark], //加载瓦片图层数据 view: mapView, target: "map", From a550a46656bba7d5b70a8958aebc4949ad32240d Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Wed, 2 Nov 2022 13:54:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index de763cc25..2e1d6b701 100644 --- a/public/index.html +++ b/public/index.html @@ -39,7 +39,7 @@ if (SITE_CONFIG['nodeEnv'] == 'dev_tdt') { toLoadJs('http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926') - } else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt1') { + } else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt') { toLoadJs('http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js') } else if (SITE_CONFIG['nodeEnv'] == 'yantai_zhengwu_prod') { toLoadJs('http://59.206.203.34/api/olapi/ol/openlayers.js')