| | |
| | | return ResponseMsg<int>.fail(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换为瓦片 |
| | | /// </summary> |
| | | [HttpPost] |
| | | public ResponseMsg<int> ToSG([FromBody]XYZArgs args) |
| | | { |
| | | try |
| | | { |
| | | |
| | | int count = 0; |
| | | |
| | | return ResponseMsg<int>.success("成功", count); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | return ResponseMsg<int>.fail(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ID |
| | | /// </summary> |
| | | public int id { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 地图最小级别 |
| | | /// </summary> |
| | | public int min { set; get; } |
| | |
| | | Process p = null; |
| | | try |
| | | { |
| | | string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -NoGui -Exit", modelFile, configFile); // -log D:\\xyz\\auto\\log.txt |
| | | //string log = Path.Combine(ExportUtil.SourcesPath, "ns_log.txt"); |
| | | //string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -log \"{2}\" -NoGui -Exit", modelFile, configFile, log); |
| | | string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -NoGui -Exit", modelFile, configFile); |
| | | LogOut.Info("Args:" + args); |
| | | |
| | | // 启动进程 |
| | |
| | | /// <returns>数据发布ID</returns> |
| | | public static int Generate(XYZArgs args, ref string err) |
| | | { |
| | | string tifFile = Path.Combine(Tool.TempDir, ExportUtil.DateStr + ".txt"); |
| | | string xyzPath = Path.Combine(SGUtils.LFData, "2d\\tiles", args.id.ToString()); |
| | | if (!Directory.Exists(xyzPath)) Directory.CreateDirectory(xyzPath); |
| | | |
| | | List<SysMeta> list = selectMetas(args.ids, "and type in ('tif', 'tiff', 'img')"); |
| | | if (null == list || list.Count == 0) return 0; |
| | | |
| | | int id = list[0].id; |
| | | string tifFile = Path.Combine(Tool.TempDir, ExportUtil.DateStr + ".txt"); |
| | | string xyzPath = Path.Combine(SGUtils.LFData, "2d\\tiles", id.ToString()); |
| | | if (!Directory.Exists(xyzPath)) Directory.CreateDirectory(xyzPath); |
| | | |
| | | WriteText(tifFile, list); |
| | | |
| | |
| | | |
| | | //string newPy = tifFile.Replace(".txt", ".py").Replace("\\", "\\\\"); |
| | | //File.WriteAllText(newPy, pyText); |
| | | |
| | | //string cmd = string.Format("exec(open('{0}', 'r', encoding='utf-8').read()) & exit()", newPy); |
| | | |
| | | err = ExecCmd(cmd); |
| | |
| | | |
| | | string viewFile = Path.Combine(xyzPath, "view.html"); |
| | | |
| | | return File.Exists(viewFile) ? args.id : 0; |
| | | return File.Exists(viewFile) ? id : 0; |
| | | } |
| | | |
| | | /// <summary> |