| | |
| | | <!-- 获取文件的MD5码:0-否,1-是 --> |
| | | <add key="GetMD5" value="1"/> |
| | | <add key="StartPath" value="3"/> |
| | | <add key="SourcePath" value="D:\Moon\data"/> |
| | | <add key="SourcePath" value="D:\Moon\data\DOM"/> |
| | | <add key="TargetPath" value="D:\LF\upload"/> |
| | | <!--<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.83;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/> |
| | | <!--<add key="pgConn" value="Server=192.168.20.83;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/>--> |
| | | <add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/> |
| | | </appSettings> |
| | | <startup> |
| | | <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> |
| | |
| | | public class DBHelper |
| | | { |
| | | // id, eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, update_user, update_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct |
| | | private const string insertMeta = "insert into lf.sys_meta (eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct) values (@eventid, @metaid, @verid, @name, @type, @guid, @path, @sizes, @tab, @rows, @create_user, now(), @bak, {0}, @layer, @depcode, @dircode, @ismeta, @sensortype, @acq_time, @resolution, @gridsize, @coor_sys, @epsg, @h_datum, @mata_type, @bands, @band_type, @ct) returning id"; |
| | | private const string insertMeta = "insert into lf.sys_meta (eventid, metaid, verid, name, type, guid, path, sizes, tab, rows, create_user, create_time, bak, geom, layer, depcode, dircode, ismeta, sensortype, acq_time, resolution, gridsize, coor_sys, epsg, h_datum, mata_type, bands, band_type, ct, min, max) values (@eventid, @metaid, @verid, @name, @type, @guid, @path, @sizes, @tab, @rows, @create_user, now(), @bak, {0}, @layer, @depcode, @dircode, @ismeta, @sensortype, @acq_time, @resolution, @gridsize, @coor_sys, @epsg, @h_datum, @mata_type, @bands, @band_type, @ct, @min, @max) returning id"; |
| | | |
| | | /// <summary> |
| | | /// 插入元数据 |
| | |
| | | ColorTable ct = ds.GetRasterBand(1).GetRasterColorTable(); |
| | | vd.Meta.ct = null == ct ? null : ct.ToString(); // 数据颜色表 |
| | | vd.Meta.h_datum = null; // 高程基准 |
| | | setMinAndMax(ds, vd.Meta); // 设置最值 |
| | | |
| | | double[] tr = new double[6]; |
| | | ds.GetGeoTransform(tr); |
| | |
| | | |
| | | return geo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置最值 |
| | | /// GDALRasterBand::GetHistogram 统计直方图 |
| | | /// </summary> |
| | | private void setMinAndMax(Dataset ds, SysMeta meta) |
| | | { |
| | | List<double> minList = new List<double>(); |
| | | List<double> maxList = new List<double>(); |
| | | |
| | | for (int i = 1; i <= ds.RasterCount; i++) |
| | | { |
| | | int hasval; |
| | | double min, max; |
| | | ds.GetRasterBand(i).GetMinimum(out min, out hasval); |
| | | ds.GetRasterBand(i).GetMaximum(out max, out hasval); |
| | | |
| | | minList.Add(min); |
| | | maxList.Add(max); |
| | | } |
| | | |
| | | meta.min = string.Join(",", minList.ToArray()); |
| | | meta.max = string.Join(",", maxList.ToArray()); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| | | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| | | Height="700" Width="900" Loaded="Window_Loaded" Closing="Window_Closing" |
| | | Title="数据入库 v1.7" WindowStartupLocation="CenterScreen"> |
| | | Title="数据入库 v1.72" WindowStartupLocation="CenterScreen"> |
| | | <Window.Resources> |
| | | <Style x:Key="btn" TargetType="Button"> |
| | | <Setter Property="Background" Value="#005699"/> |
| | |
| | | public string bands { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 最小值 |
| | | /// </summary> |
| | | public string min { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 最小大值 |
| | | /// </summary> |
| | | public string max { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 波段数据类型 |
| | | /// </summary> |
| | | public string band_type { set; get; } |