- 积分
- 142
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-18
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2015-4-24 15:46:34
|
显示全部楼层
//加载图层
VectorLayer Layer = new VectorLayer(ShapeTypes.Polygon);
Layer = (VectorLayer)MapDataManage.OpenLayer(Application.StartupPath + @"\map\mapin.shp");
//获取数据
StationData stationData = new StationData();
stationData.Data = new double[3, 1];
//模拟一个站的数据
stationData.Data[0, 0] = 112.02805555556;
stationData.Data[1, 0] = 31.389722222222;
stationData.Data[2, 0] = 1.3;
//设置插值格点数据
GridDataSetting aGDP = new GridDataSetting();
Extent ex = new Extent();
ex.minX = 30;
ex.minY = 30;
ex.maxX = 150;
ex.maxY = 150;
aGDP.DataExtent = ex; //加入插值范围
aGDP.YNum = 100; //格点点数
aGDP.XNum = 100; //格点点数
//插值方法
InterpolationSetting agrid = new InterpolationSetting();
agrid.GridDataSet = aGDP;
agrid.InterpolationMethod = InterpolationMethods.IDW_Radius;
agrid.Radius = 2;
agrid.MinPointNum = 1;
double[] X = new double[1];
double[] Y = new double[1];
ContourDraw.CreateGridXY(aGDP, ref X, ref Y);
double[,] S = stationData.Data;
S = ContourDraw.FilterDiscreteData_Radius(S, agrid.Radius, agrid.GridDataSet.DataExtent, stationData.UNDEF);
GridData grid = ContourDraw.InterpolateDiscreteData_Radius(S, X, Y, agrid.MinPointNum, agrid.Radius, stationData.UNDEF);
bool hasNoData = true;
LegendScheme lgd = LegendManage.CreateLegendSchemeFromGridData(grid, LegendType.GraduatedColor, ShapeTypes.Polygon, ref hasNoData);
ouble min = grid.GetMinValue();
double max = grid.GetMaxValue();
lgd.ImportFromXMLFile(Application.StartupPath + @"\map\rain.lgs");
gd.MaxValue = max;
lgd.MinValue = min;
VectorLayer lineLayer = new VectorLayer(ShapeTypes.Polygon);
lineLayer = DrawMeteoData.CreateShadedLayer(grid, lgd, "图例(毫米)", "LGD");
lineLayer.Visible = true;
ineLayer.IsMaskout = true;
加入图层
layersLegend1.ActiveMapFrame.AddLayer(lineLayer);
layersLegend1.ActiveMapFrame.AddLayer(Layer);
这是是参考论坛的帖子做的,但是不行,请老师指点一下,哪里有问题 |
|