Просмотр исходного кода

增加其它行业的热力图(暂注释)

mork 2 недель назад
Родитель
Сommit
b4ef5e8200
2 измененных файлов с 96 добавлено и 38 удалено
  1. 59 8
      public/static/config/config.js
  2. 37 30
      src/views/HomeView.vue

+ 59 - 8
public/static/config/config.js

@@ -150,41 +150,92 @@ var webConfig = {
         // 沿街店铺-卫生
         // 沿街店铺-娱乐业
         // 沿街店铺-住宿业
+
+        // 沿街店铺-建筑业
+        // 沿街店铺-教育业
+        // 沿街店铺-房地产业
+        // 沿街店铺-商业服务业
+        // 沿街店铺-公共管理
+        // 沿街店铺-制造业
+        // 沿街店铺-广播
+
         {
             name: "餐饮行业热力图",
+            alias: "餐饮业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-餐饮业.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-餐饮业.geojson"
         },
         {
             name: "居民服务行业热力图",
+            alias: "居民服务业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-居民服务业.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-居民服务业.geojson"
         },
         {
             name: "零售行业热力图",
+            alias: "零售业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-零售业.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-零售业.geojson"
         },
         {
             name: "体育行业热力图",
+            alias: "体育业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-体育业.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-体育业.geojson"
         },
         {
             name: "卫生行业热力图",
+            alias: "卫生",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-卫生.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-卫生.geojson"
         },
         {
             name: "娱乐行业热力图",
+            alias: "娱乐业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-娱乐业.geojson"
+            // url: "./static/data/heatMapData/沿街店铺-娱乐业.geojson"
         },
         {
             name: "住宿行业热力图",
+            alias: "住宿业",
             type: "heatmap",
-            url: "./static/data/heatMapData/沿街店铺-住宿业.geojson"
-        }
+            // url: "./static/data/heatMapData/沿街店铺-住宿业.geojson"
+        },
+
+        // {
+        //     name: "建筑行业热力图",
+        //     alias: "建筑业",
+        //     type: "heatmap",
+        // },
+        // {
+        //     name: "教育行业热力图",
+        //     alias: "教育业",
+        //     type: "heatmap",
+        // },
+        // {
+        //     name: "房地产行业热力图",
+        //     alias: "房地产业",
+        // },
+        // {
+        //     name: "商业服务行业热力图",
+        //     alias: "商业服务业",
+        //     type: "heatmap",
+        // },
+        // {
+        //     name: "公共管理行业热力图",
+        //     alias: "公共管理",
+        //     type: "heatmap",
+        // },
+        // {
+        //     name: "制造行业热力图",
+        //     alias: "制造业",
+        //     type: "heatmap",
+        // },
+        // {
+        //     name: "广播行业热力图",
+        //     alias: "广播",
+        //     type: "heatmap",
+        // }
     ]
 }
 

+ 37 - 30
src/views/HomeView.vue

@@ -691,31 +691,36 @@ export default {
       this.yjdpShow = !this.yjdpShow
       if (this.yjdpShow) {
 
-        //  fetch("./static/data/test.geojson")
-        //   .then(response => response.json())
-        //   .then(function (result) {
-        //     console.log(result);
-        //     let feat = {type: 'FeatureCollection', features: []}
-        //     let feat2 = {type: 'FeatureCollection', features: []}
-        //     let feat3 = {type: 'FeatureCollection', features: []}
-        //     result.features.forEach(e => {
-        //       let fet = {geometry:{},properties:{},type: "Feature"}
-        //       fet.geometry =  e.geometry;
-        //       let prop = {}
-        //       prop["街镇"]=e.properties.street;
-        //       prop["道路名称"]=e.properties.road;
-        //       prop["地址"]=e.properties.address;
-        //       prop["uuid"]=that.generateUUID();
-        //       // prop["店铺类型"]=e.properties.type == '#N/A' ? e.properties["大类"] : e.properties.type;
-        //       prop["店铺名称"]=e.properties.name;
-        //       // prop["大类"]=e.properties["大类"];
-        //       prop["店铺类型"] =e.properties["大类"].split("、")[0];
-        //       fet.properties= prop;
-        //       feat.features.push(fet);
-        //     });
-        //    console.log(feat);
-        //   }
-        // )
+         fetch("./static/data/test.geojson")
+          .then(response => response.json())
+          .then(function (result) {
+            console.log(result);
+            let feat = {type: 'FeatureCollection', features: []}
+            let feat2 = {type: 'FeatureCollection', features: []}
+            let feat3 = {type: 'FeatureCollection', features: []}
+            let arr = []
+            result.features.forEach(e => {
+              let fet = {geometry:{},properties:{},type: "Feature"}
+              fet.geometry =  e.geometry;
+              let prop = {}
+              prop["街镇"]=e.properties.street;
+              prop["道路名称"]=e.properties.road;
+              prop["地址"]=e.properties.address;
+              prop["uuid"]=that.generateUUID();
+              // prop["店铺类型"]=e.properties.type == '#N/A' ? e.properties["大类"] : e.properties.type;
+              prop["店铺名称"]=e.properties.name;
+              // prop["大类"]=e.properties["大类"];
+              prop["店铺类型"] =e.properties["大类"].split("、")[0];
+              arr.push(e.properties["大类"].split("、")[0])
+              
+              fet.properties= prop;
+              feat.features.push(fet);
+            });
+            const uniqueArray = [...new Set(arr)]
+            console.log(uniqueArray);
+           console.log(feat);
+          }
+        )
 
         // 添加
         fetch("./static/data/沿街店铺-20251029.geojson")
@@ -929,8 +934,6 @@ export default {
     },
     // 热力图列表展示-MB
     handleOpenHeatmapPanelShowMb(){
-        console.log(111);
-        
         this.layerInfoDrawerShow = false
         if(this.heatInfoDrawerShow){
           this.heatInfoDrawerShow = false
@@ -950,7 +953,6 @@ export default {
     },
     // 图层列表展示-MB
     handleOpenLayerPanelShowMB(){
-      console.log(2222);
        this.heatInfoDrawerShow = false
        if(this.layerInfoDrawerShow){
           this.layerInfoDrawerShow = false
@@ -998,10 +1000,15 @@ export default {
     addHeatMapLayer(judge, params) {
       let that = this;
       if (judge) {
-        fetch(params.url)
+        // fetch(params.url)
+        fetch("./static/data/沿街店铺-20251029.geojson")
           .then(response => response.json())
           .then(function (result) {
-            let arr = result.features.map(function (item) {
+            // 过滤空店铺数据
+            result=result.features.filter(person => 
+              person.properties['店铺类型'] == params.alias
+            );
+            let arr = result.map(function (item) {
               let coor = item.geometry.coordinates
               return {
                 x: coor[0],