| | |
| | | { |
| | | try |
| | | { |
| | | List<SysMeta> metas = XYZUtils.SelectMetas(args.ids, "and type in ('tif', 'tiff')"); |
| | | List<SysMeta> metas = XYZUtils.SelectMetas(args.ids, "and type in ('tif', 'tiff', 'dem')"); |
| | | if (null == metas || metas.Count == 0) return PrintInfo("找不到元数据"); |
| | | |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | |
| | | /// </summary> |
| | | private static void CreateTerrain(XYZArgs args, string tifFile, ref string err) |
| | | { |
| | | string ctbPath = Tools.GetSetting("ctbPath"); |
| | | string ctbPath = Tools.GetSetting("ctbJL"); |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | | int maxLevel = GetTerrainMaxLevel(args, tifFile); |
| | | //int maxLevel = GetTerrainMaxLevel(args, tifFile); |
| | | |
| | | string gdal_data = string.Format("set GDAL_DATA={0}\\data", ctbPath); |
| | | // -N 顶点法线, -C 强制创建缺失根瓦片, -R 不覆盖现有文件 |
| | | string createMesh = string.Format("{0}\\ctb-tile.exe -R -C -s {4} -o \"{1}\" -f Mesh \"{2}\\{3}.tif\"", ctbPath, dirPath, dirPath, args.dircode, maxLevel); |
| | | //string createLayer = string.Format("{0}\\ctb-tile.exe -l -s {4} -o \"{1}\" -f Mesh \"{2}\\{3}.tif\"", ctbPath, dirPath, dirPath, args.dircode, maxLevel); |
| | | // -N 顶点法线, -C 强制创建缺失根瓦片, -R 不覆盖现有文件,-f Mesh |
| | | string createMesh = string.Format("{0}\\ctb-tile.exe -s {1} -o \"{2}\" \"{3}\"", ctbPath, TERRAIN_MAX_LEVEL, dirPath, tifFile); |
| | | |
| | | List<string> list = new List<string>() { gdal_data, createMesh }; |
| | | SysTask task = TaskDBHelper.CreateTask(args, "DEM", "高程数据(DEM)"); |
| | |
| | | CreateVrt(files, vrt); |
| | | if (!File.Exists(vrt)) return null; |
| | | |
| | | string ctbPath = Tools.GetSetting("ctbPath"); |
| | | string ctbPath = Tools.GetSetting("ctbJL"); |
| | | string gdal_data = string.Format("set GDAL_DATA={0}\\data", ctbPath); |
| | | string createLayer = string.Format("{0}\\ctb-tile.exe -l -o \"{1}\" -f Mesh \"{2}\"", ctbPath, dirPath, vrt); |
| | | string createLayer = string.Format("{0}\\ctb-tile.exe -l -s {1} -o \"{2}\" \"{3}\"", ctbPath, TERRAIN_MAX_LEVEL, dirPath, vrt); |
| | | Tools.ExecCmd(new List<string>() { gdal_data, createLayer }); |
| | | |
| | | return vrt; |
| | |
| | | FileInfo fi = new FileInfo(tifFile); |
| | | if (fi.Length > DEFAULT_MAX_SIZE) return TERRAIN_MAX_LEVEL; |
| | | |
| | | string ctbPath = Tools.GetSetting("ctbPath"); |
| | | string ctbPath = Tools.GetSetting("ctbJL"); |
| | | string dirPath = GetTerrainPath(args.dircode); |
| | | string subPath = Path.Combine(dirPath, "subs"); |
| | | |
| | | string gdal_data = string.Format("set GDAL_DATA={0}\\data", ctbPath); |
| | | string createLayer = string.Format("{0}\\ctb-tile.exe -l -o \"{1}\" -f Mesh \"{2}\\{3}.tif\"", ctbPath, dirPath, dirPath, args.dircode); |
| | | string createLayer = string.Format("{0}\\ctb-tile.exe -l -o \"{1}\" \"{2}\"", ctbPath, subPath, tifFile); |
| | | |
| | | Tools.ExecCmd(new List<string>() { gdal_data, createLayer }); |
| | | |
| | | string layerJson = Path.Combine(dirPath, "layer.json"); |
| | | string layerJson = Path.Combine(subPath, "layer.json"); |
| | | if (!File.Exists(layerJson)) return TERRAIN_MAX_LEVEL; |
| | | |
| | | string[] lines = File.ReadAllLines(layerJson, Encoding.UTF8); |
| | |
| | | public static void Reproject(string sourceFile, string targetFile, string sourceSrs, string targetSrs) |
| | | { |
| | | string gdalPath = Tools.GetSetting("gdalPath"); |
| | | string cmd = string.Format("{0}\\gdalwarp.exe -s_srs {1} -t_srs {2} -r near -of GTiff {3} {4}", gdalPath, sourceSrs, targetSrs, sourceFile, targetFile); |
| | | string cmd = string.Format("\"{0}\\gdalwarp.exe\" -s_srs {1} -t_srs {2} -r near -of GTiff \"{3}\" \"{4}\"", gdalPath, sourceSrs, targetSrs, sourceFile, targetFile); |
| | | |
| | | Tools.ExecCmd(new List<string> { cmd }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 指定投影 |
| | | /// 指定投影 * |
| | | /// </summary> |
| | | public static void Project(string sourceFile, string targetSrs) |
| | | { |