bill před 2 měsíci
rodič
revize
884477dd36
2 změnil soubory, kde provedl 18 přidání a 11 odebrání
  1. 0 1
      src/layout/edit/scene-select.vue
  2. 18 10
      src/store/map.ts

+ 0 - 1
src/layout/edit/scene-select.vue

@@ -260,7 +260,6 @@ const selectModel = async () => {
     format: ["obj", "ply", "las", "laz", "b3dm", "shp", "osgb", "glb"],
     maxSize: 2 * 1024 * 1024 * 1024,
   });
-  debugger
   if (!list?.length) return;
   list = list.filter(item => item.uploadId)
   // const modelList = await Promise.all(list.map(item => uploadMaterialToModel(item.uploadId!)))

+ 18 - 10
src/store/map.ts

@@ -1,4 +1,5 @@
 import { params } from "@/env";
+import { aMapToWgs84 } from "@/utils/coord";
 
 export type Address = { address: string; latlng: number[]; id: string };
 const platform = {
@@ -15,13 +16,21 @@ const platform = {
         }
         console.log(res);
         const items = res.geocodes
-          .map((item: any) => ({
-            id: item.location,
-            address: item.formatted_address,
-            latlng: item.location
+          .map((item: any) => {
+            const ll = item.location
               .split(",")
-              .map((item: string) => Number(item.trim())),
-          }))
+              .map((item: string) => Number(item.trim()));
+            const p = aMapToWgs84({
+              x: Number(ll[0]),
+              y: Number(ll[1]),
+            });
+
+            return {
+              id: item.location,
+              address: item.formatted_address,
+              latlng: [p.x, p.y]
+            };
+          })
           .slice(0, 10);
         return items;
       });
@@ -31,7 +40,6 @@ const platform = {
     tipParams.set("basic", "y");
     tipParams.set("key", val);
     tipParams.set("location", "113.05,22.61");
-
     const keyList = (await fetch(`/s/api/gettips?${tipParams.toString()}`)
       .then((res) => res.json())
       .then((res) => res.data)) as { name: string }[];
@@ -54,14 +62,14 @@ const platform = {
         });
     });
 
-    await Promise.all(reqs)
-    return items
+    await Promise.all(reqs);
+    return items;
   },
 };
 
 export const searchAddress = (val: string): Promise<Address[]> => {
   if (!val) return Promise.resolve([]);
-  console.log(import.meta.env.VITE_MAP_PLATFORM)
+  console.log(import.meta.env.VITE_MAP_PLATFORM);
   const p = (
     params.mapPlatform && params.mapPlatform in platform
       ? params.mapPlatform