管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-07-15 ae436e2cb0980af757511377215a454c17a35308
ExportMap/cs/LasUtils.cs
@@ -58,7 +58,7 @@
                    string cmd = string.Format("{0}\\gocesiumtiler.exe -i \"{1}\" -o \"{2}\" -e {3} -z {4} -g -s", tilerPath, lasPath, outPath, args.srid, args.z);
                    err = Tools.ExecCmd(cmd, false, false);
                    string jsonFile = findTileset(outPath);
                    string jsonFile = findTileset(meta, outPath);
                    if ("laz" == meta.type && File.Exists(lasPath)) File.Delete(lasPath);
                    if (File.Exists(jsonFile))
                    {
@@ -85,7 +85,7 @@
        {
            string lasPath = outPath.Replace("laz", "laz");
            string tilerPath = Tools.GetSetting("tilerPath");
            string cmd = string.Format("{0}\\laszip64.exe -i \"{1}\" -o \"{2}\"", tilerPath, lazPath, lasPath);
            Tools.ExecCmd(cmd, false, false);
@@ -95,8 +95,10 @@
        /// <summary>
        /// 查找tileset.json
        /// </summary>
        private static string findTileset(string path)
        private static string findTileset(SysMeta meta, string path)
        {
            PathRename(meta, path);
            DirectoryInfo di = new DirectoryInfo(path);
            FileInfo[] fis = di.GetFiles("tileset.json", SearchOption.AllDirectories);
@@ -104,11 +106,30 @@
        }
        /// <summary>
        /// 路径重命名
        /// </summary>
        private static void PathRename(SysMeta meta, string path)
        {
            try
            {
                string subPath = Path.Combine(path, meta.guid);
                if (Directory.Exists(subPath))
                {
                    string newPath = Path.Combine(path, meta.id.ToString());
                    Directory.Move(subPath, newPath);
                }
            }
            catch
            {
            }
        }
        /// <summary>
        /// 插入数据库
        /// </summary>
        private static int InsertToDB(SysMeta meta, XYZArgs args, string path)
        {
            if (PubDBHelper.IsPublish(meta.id)) return 0;
            if (PubDBHelper.IsPublish(meta.id)) return 1;
            SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(path), path);
@@ -122,5 +143,37 @@
            return pubid;
        }
        /// <summary>
        /// 读取Las坐标系
        /// </summary>
        public static List<int> ReadLasCs(XYZArgs args, ref string err)
        {
            List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type in ('las', 'laz')");
            if (null == list || list.Count == 0) return null;
            string uploadFolder = Tools.GetSetting("uploadFolder");
            List<int> ids = new List<int>();
            foreach (SysMeta meta in list)
            {
                string lasPath = Path.Combine(uploadFolder, meta.path);
                if (!File.Exists(lasPath)) continue;
                int epsg = 0;
                try
                {
                    epsg = Tools.get_las_cs(lasPath.Replace("\\", "/"));
                }
                catch (Exception ex)
                {
                    LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                    epsg = -1;
                }
                ids.Add(epsg);
            }
            return ids;
        }
    }
}