| | |
| | | string tifFile = null; |
| | | try |
| | | { |
| | | //tifFile = Merge(args, ref err); |
| | | tifFile = Path.Combine(GetTerrainPath(args.dircode), args.dircode + ".tif"); |
| | | List<SysMeta> metas = XYZUtils.SelectMetas(args.ids, "and type in ('tif', 'tiff')"); |
| | | if (null == metas || metas.Count == 0) return null; |
| | | |
| | | tifFile = Merge(metas, args, ref err); |
| | | if (!File.Exists(tifFile)) return null; |
| | | |
| | | Generate(args, tifFile, ref err); |
| | | Save(args); |
| | | |
| | | return null; |
| | | string path = GetTerrainPath(args.dircode); |
| | | string json = Path.Combine(path, "layer.json"); |
| | | if (!File.Exists(json)) return null; |
| | | |
| | | List<int> ids = new List<int>(); |
| | | int pubid = InsertToDB(metas, args); |
| | | if (pubid > 0) ids.Add(pubid); |
| | | |
| | | return ids; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | if (string.IsNullOrEmpty(tifFile) && File.Exists(tifFile)) |
| | | if (!string.IsNullOrEmpty(tifFile) && File.Exists(tifFile)) |
| | | { |
| | | File.Delete(tifFile); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 合并 |
| | | /// </summary> |
| | | public static string Merge(XYZArgs args, ref string err) |
| | | public static string Merge(List<SysMeta> metas, XYZArgs args, ref string err) |
| | | { |
| | | string txtFile = null; |
| | | try |
| | | { |
| | | List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type in ('tif', 'tiff')"); |
| | | if (null == list || list.Count == 0) return null; |
| | | |
| | | txtFile = Path.Combine(Tools.TempDir, ExportUtil.DateStr + ".txt"); |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | | if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); |
| | |
| | | string tifFile = Path.Combine(dirPath, args.dircode + ".tif"); |
| | | if (File.Exists(tifFile)) File.Delete(tifFile); |
| | | |
| | | WriteText(txtFile, list); |
| | | WriteText(txtFile, metas); |
| | | |
| | | string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\"", PyFile, Qgz, txtFile, tifFile); |
| | | err = Tools.ExecCmd(cmd, true); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存 |
| | | /// 插入数据库 |
| | | /// </summary> |
| | | private static void Save(XYZArgs args) |
| | | private static int InsertToDB(List<SysMeta> metas, XYZArgs args) |
| | | { |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | } |
| | | } |