爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2768|回复: 2

Meteoinfo生成色斑图问题求助

[复制链接]

新浪微博达人勋

发表于 2021-12-15 10:18:36 | 显示全部楼层 |阅读模式

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

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

x
数据:

                               
登录/注册后可看大图

出图效果:

                               
登录/注册后可看大图


从图片看明显是错误的。折腾了很久了没有发现什么原因,Debug确认插值结果是对的,就是出图不行,感觉和legendScheme有关,但很多函数看不懂啊,文档也比较缺乏。请大佬帮忙看下吧。



我的代码
  1. VectorLayer clipLayer = MapDataManage.readMapFile_ShapeFile(shpFile);


  2.         //初始化图层和画布
  3.         var mapLayout = new MapLayout();
  4.         var mapView = MeteoInfoHelper.createMapView(mapLayout,this.mapconfig,clipLayer);



  5.         //读入站点数据
  6.         var stationData =  MeteoInfoHelper.getStationData(req.getDS());
  7.         stationData.projInfo = clipLayer.getProjInfo();


  8.         //设定插值参数
  9.         GridDataSetting gridDataSetting = new GridDataSetting();
  10.         gridDataSetting.dataExtent = clipLayer.getExtent();
  11.         gridDataSetting.xNum = 20;// 格点点数
  12.         gridDataSetting.yNum =30;// 格点点数
  13.         //插值
  14.         InterpolationSetting interSet = new InterpolationSetting();
  15.         interSet.setGridDataSetting(gridDataSetting);
  16.         interSet.setInterpolationMethod(InterpolationMethods.KRIGING);
  17.         interSet.setMinPointNum(1);
  18.         GridData gridData = GeoMathUtil.interpolateData(stationData,interSet);


  19.         double[] minMax=MeteoInfoHelper.getMaxAndMin(req.getDS());
  20.         var legendScheme = new LegendScheme(ShapeTypes.POLYGON);
  21.         legendScheme.importFromXMLFile(lgsFile);
  22.         legendScheme.setHasNoData(false);
  23.         legendScheme.setMinValue(0);
  24.         //插值生成图层
  25.         VectorLayer contourLayer = DrawMeteoData.createShadedLayer(gridData, legendScheme, "Tem", "Value",
  26.                 mapconfig.getSmooth()>0);
  27.         //裁切图片
  28.         VectorLayer dataLayer = contourLayer.clip(clipLayer);
  29.         mapView.addLayer(dataLayer);

  30.         var staLayout=MeteoInfoHelper.LoadStation(req.getDS(),0);
  31.         mapView.addLayer(staLayout);

  32.         if(req.getTitle()!=null){
  33.             mapLayout.addText(req.getTitle(), 200, 35, "宋体", 35);
  34.         }
  35.         var aLegend = mapLayout.addLegend(800, 307);
  36.         aLegend.setLegendStyle(LegendStyles.NORMAL);
  37.         aLegend.setFont(new Font("宋体",Font.PLAIN,20));
  38.         //= ;
  39.         aLegend.setHeight(370);
  40.         aLegend.setWidth(100);



  41.         //生成剪切图层
  42.         PolygonBreak aPGB2 = (PolygonBreak)clipLayer.getLegendScheme().getLegendBreak(0);//LegendBreaks[0];
  43.         aPGB2.setDrawFill(false);// = false;
  44.         aPGB2.setDrawOutline(true);// = true;
  45.         aPGB2.setOutlineColor(Color.darkGray);// = Color.Gray;
  46.         aPGB2.setOutlineSize(2);
  47.         dataLayer.setMaskout(true);//= true;

  48.         //mapFrame.addLayer(dataLayer);
  49.         //mapFrame.moveLayer(dataLayer,0);

  50.         mapLayout.getActiveMapFrame().addLayer(clipLayer);
  51.         aLegend.setTitle("能见度(km)") ;

  52.         toImageStream(response, mapLayout);
复制代码
Lgs文件内容
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LegendScheme FieldName="Value" LegendType="UniqueValue"
  3.               ShapeType="Polygon" BreakNum="5"
  4.               HasNoData="False" MinValue="0" MaxValue="999" UNDEF="-9999">
  5.   <Breaks>
  6.     <Break Caption="0~0.2" StartValue="0" EndValue="0.2" Color="#63220A" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  7.     <Break Caption="0.2~0.5" StartValue="0.2" EndValue="0.5" Color="#7B1EEA" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  8.     <Break Caption="0.5~1" StartValue="0.5" EndValue="1" Color="#D01F05" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  9.     <Break Caption="1~2" StartValue="1" EndValue="2" Color="#D35C07" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  10.     <Break Caption="2~3" StartValue="2" EndValue="3" Color="#E9B155" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  11.         <Break Caption="3~5" StartValue="3" EndValue="5" Color="#FCFB24" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  12.          <Break Caption="5~10" StartValue="5" EndValue="10" Color="#AEF546" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  13.           <Break Caption="10~20" StartValue="10" EndValue="20" Color="#AFDBFE" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  14.           <Break Caption="20~30" StartValue="20" EndValue="30" Color="#D1EDFF" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  15.           <Break Caption="30以上" StartValue="30" EndValue="999" Color="#FFFFFF" DrawShape="True" OutlineColor="Gray" DrawOutline="False" DrawFill="True" OutlineSize="1" />
  16.   </Breaks>
  17. </LegendScheme>
复制代码

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

新浪微博达人勋

发表于 2021-12-15 11:09:18 | 显示全部楼层
可以先用  MeteoInfo   制作一下试试,   interSet.setMinPointNum(1);   估计这句话影响了差值。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2021-12-15 12:35:43 | 显示全部楼层
cmy 发表于 2021-12-15 11:09
可以先用  MeteoInfo   制作一下试试,   interSet.setMinPointNum(1);   估计这句话影响了差值。

尝试了一下注释掉interSet.setMinPointNum(1);,以及interSet.setMinPointNum(3); 没有任何变化
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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