| | |
| | | if len(lines[i]) == 0: |
| | | continue |
| | | |
| | | print("layer_" + str(i) + ": " + lines[i]) |
| | | layer = QgsRasterLayer(lines[i], "layer_" + str(i)) |
| | | strs = lines[i].split(",") |
| | | prefix = "__" if "1" == strs[1] else "_" |
| | | print("layer" + prefix + str(i) + ": " + strs[0]) |
| | | |
| | | layer = QgsRasterLayer(strs[0], "layer" + prefix + str(i)) |
| | | if not layer.isValid() or layer.crs() is None: |
| | | print("layer_" + str(i) + ": failed to load!") |
| | | print("layer" + prefix + str(i) + ": failed to load!") |
| | | continue |
| | | |
| | | for j in range(1, layer.bandCount() + 1): |
| | |
| | | import processing |
| | | |
| | | for layer in prj.mapLayers().values(): |
| | | if "layer__" in layer.id(): |
| | | continue |
| | | |
| | | e = layer.extent() |
| | | prj.setCrs(layer.crs()) |
| | | epsg = '' if layer.crs() is None else ' [' + layer.crs().authid() + ']' |
| | | args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str(e.yMaximum()) + epsg |
| | | args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str( |
| | | e.yMaximum()) + epsg |
| | | ops = get_xyz_ops(args) |
| | | processing.run("qgis:tilesxyzdirectory", ops) |
| | | |
| | |
| | | <add key="mpt" value="D:\LF\data\mpt\tb.mpt" /> |
| | | <!-- PG连接 --> |
| | | <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>--> |
| | | <!--<add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>--> |
| | | <add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/> |
| | | <add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/> |
| | | <!--<add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>--> |
| | | <add key="webpages:Version" value="3.0.0.0"/> |
| | | <add key="webpages:Enabled" value="false"/> |
| | | <add key="ClientValidationEnabled" value="true"/> |
| | |
| | | //if (args.isNew && Directory.Exists(xyzPath)) Tools.DelPath(xyzPath); // 已存在的,删除 |
| | | if (!Directory.Exists(xyzPath)) Directory.CreateDirectory(xyzPath); |
| | | |
| | | WriteText(txtFile, list); |
| | | int pubid = PubDBHelper.GetPushlishId(args.dircode, "DOM"); |
| | | List<int> mids = PubDBHelper.GetPublishMetaId(pubid); |
| | | WriteText(txtFile, list, mids); |
| | | |
| | | string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\" -min {4} -max {5} -noData {6}", PyFile, Qgz, txtFile, xyzPath, args.min, args.max, args.noData); |
| | | SysTask task = TaskDBHelper.CreateTask(args, "DOM", "影像数据(DOM)"); |
| | |
| | | if (File.Exists(viewFile)) |
| | | { |
| | | string path = "2d\\tiles" + "\\" + args.dircode; |
| | | int pubid = InsertToDB(list, args, path); |
| | | pubid = InsertToDB(list, args, path); |
| | | |
| | | if (pubid > 0) ids.Add(pubid); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 写文本文件 |
| | | /// </summary> |
| | | private static void WriteText(string file, List<SysMeta> list) |
| | | private static void WriteText(string file, List<SysMeta> list, List<int> mids) |
| | | { |
| | | string uploadFolder = Tools.GetSetting("uploadFolder"); |
| | | |
| | |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | string filePath = Path.Combine(uploadFolder, meta.path); |
| | | if (File.Exists(filePath)) files.Add(filePath); |
| | | if (!File.Exists(filePath)) continue; |
| | | |
| | | bool exists = mids.Contains(meta.id); |
| | | files.Add(string.Format("{0},{1}", filePath, exists ? 1 : 0)); |
| | | } |
| | | //files.Add(@"E:\01.Data\33.DOM\2.大庆DOM\5154.50-415.50.tif"); |
| | | //files.Add(@"E:\01.Data\33.DOM\2.大庆DOM\5154.50-416.00.tif"); |