爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4519|回复: 9

二次开发 画等值线出错

[复制链接]

新浪微博达人勋

发表于 2013-9-12 09:53:25 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
本帖最后由 sskkyy2008 于 2013-9-12 10:20 编辑

                    if(radioButton2.Checked==true)//等值线
                    {

                        StationData stationData = openinfo.GetStationData("值");
                        MeteoInfoC.Data.MeteoData.GridDataSetting aGDP = new GridDataSetting();
                        //  aGDP.DataExtent
                        aGDP.DataExtent.minX = 100;
                        aGDP.DataExtent.maxX = 120;
                        aGDP.DataExtent.minY = 10;
                        aGDP.DataExtent.maxY = 40;
                        aGDP.XNum = 10;
                        aGDP.YNum = 10;
                        //  MeteoInfoC.Data.MeteoData.InterpolationSetting ttt = new GRIBParameterTable();
                        MeteoInfoC.Data.MeteoData.InterpolationSetting gridInterp = new InterpolationSetting();
                        gridInterp.GridDataSet = aGDP;
                        //  gridInterp.GridDataParaV = aGDP;
                        gridInterp.InterpolationMethod = MeteoInfoC.Data.MeteoData.InterpolationMethods.IDW_Radius;
                        // gridInterp.GridInterMethodV = GridInterMethod.Cressman;
                        gridInterp.Radius = 2;//搜索半径
                        gridInterp.MinPointNum = 1;
                        double[] X = new double[1];
                        double[] Y = new double[1];
                        // ContourDraw.CreateGridXY(gridInterp.GridDataParaV, ref X, ref Y);
                         ContourDraw.CreateGridXY(gridInterp.GridDataSet, ref X, ref Y);
                        double[,] S = stationData.Data;
                        GridData gridData = ContourDraw.InterpolateDiscreteData_Radius(S,
                        X, Y, gridInterp.MinPointNum, gridInterp.Radius, stationData.MissingValue);
                        LegendScheme aLS2 = new LegendScheme(ShapeTypes.Polyline);

                       // aLS2.ImportFromXMLFile(Application.StartupPath + @"\lgs\" + lgs);
                        bool hasUndefData = false;

                        LegendScheme aLS = LegendManage.CreateLegendSchemeFromGridData(gridData,
                        LegendType.UniqueValue, ShapeTypes.Polyline, ref hasUndefData);

                        
                        VectorLayer aLayer = DrawMeteoData.CreateContourLayer(gridData, aLS2, shpname, shpfieldnme);
                        layersLegend1.ActiveMapFrame.AddLayer(aLayer);
                        layersLegend1.ActiveMapFrame.MoveLayer(aLayer.Handle, 2);
                        layersLegend1.Refresh();
                        //设置掩膜
                        layersLegend1.ActiveMapFrame.MapView.MaskOut.SetMaskLayer = true;
                        //  layersLegend1.ActiveMapFrame.MapView.MaskOut.MaskLayer = Application.StartupPath + @"\map\dazhoumask.shp";
                        MapLayer maskLayer = MapDataManage.OpenLayer(Application.StartupPath + @"\map\" + masktu);
                        layersLegend1.ActiveMapFrame.MapView.MaskOut.MaskLayer = maskLayer.LayerName;
                        layersLegend1.ActiveMapFrame.AddLayer(maskLayer);
                        layersLegend1.ActiveMapFrame.MoveLayer(maskLayer, 1);
                        layersLegend1.ActiveMapFrame.MapView.PaintLayers();
                        layersLegend1.Refresh();

                    }

                      调试时出错地方  LegendScheme aLS = LegendManage.CreateLegendSchemeFromGridData(gridData,LegendType.UniqueValue, ShapeTypes.Polyline, ref hasUndefData);

绘制时报错 算数溢出错误

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-9-12 10:41:54 | 显示全部楼层
至少要把详细的错误信息贴出来吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-9-12 10:57:34 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-9-12 11:16:49 | 显示全部楼层
sskkyy2008 发表于 2013-9-12 10:57
出错提示:

程序挺乱的,你到底要用aLS还是aLS2?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-9-12 11:27:55 | 显示全部楼层
MeteoInfo 发表于 2013-9-12 11:16
程序挺乱的,你到底要用aLS还是aLS2?

谢谢老师找到原因了 是应该用als
但是出来的 的等值线怎么想这样呢

QQ图片20130912112738.jpg
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-9-12 11:48:25 | 显示全部楼层
sskkyy2008 发表于 2013-9-12 11:27
谢谢老师找到原因了 是应该用als
但是出来的 的等值线怎么想这样呢

这就很难说了,那把数据发出来看看吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-9-12 14:23:47 | 显示全部楼层
MeteoInfo 发表于 2013-9-12 11:48
这就很难说了,那把数据发出来看看吧

数据附件上传

gisdraw.txt

7.16 KB, 下载次数: 8, 下载积分: 金钱 -5

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-9-12 14:56:01 | 显示全部楼层
sskkyy2008 发表于 2013-9-12 14:23
数据附件上传

应该是格点数据的范围、格点大小设置得不好。可以先用MeteoInfo桌面软件尝试出比较好的结果,然后在程序里利用那些参数。

我简单试了试,你可以再仔细调调
Image00458.png
Image00459.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-9-12 15:03:43 | 显示全部楼层
格点数据的范围、格点大小设置得不好,这个在代码里面是哪些属性设置这些东西啊
            aGDP.DataExtent.minX = 100;
                        aGDP.DataExtent.maxX = 120;
                        aGDP.DataExtent.minY = 10;
                        aGDP.DataExtent.maxY = 40;
                        aGDP.XNum = 10;
                        aGDP.YNum = 10;

                        //  MeteoInfoC.Data.MeteoData.InterpolationSetting ttt = new GRIBParameterTable();

                        MeteoInfoC.Data.MeteoData.InterpolationSetting gridInterp = new InterpolationSetting();

                        gridInterp.GridDataSet = aGDP;
                        //  gridInterp.GridDataParaV = aGDP;

                        gridInterp.InterpolationMethod = MeteoInfoC.Data.MeteoData.InterpolationMethods.IDW_Radius;
                        // gridInterp.GridInterMethodV = GridInterMethod.Cressman;
                        gridInterp.Radius = 2;//搜索半径
                        gridInterp.MinPointNum = 1;

是这些吗
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-9-25 17:52:54 | 显示全部楼层
很不错哦~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表