6.gis空间插值之java opengis+goetools+wcontour

本文介绍了如何使用org.geotools、wcontour等GIS库进行数据处理,包括创建测试数据、生成等值线面,以及通过IDW插值和Contour算法实现地形拟合。

需要引入的gis库:org.geotools、wcontour、org.opengis,直接上代码:

   //创建测试数据
    public List<InterpolData> createInterpolData() {
   
   
        List<InterpolData> listData = new ArrayList<>();

        double lon = 105.99;
        double lat = 32.148;
        double pValue = 60;
        for (int i = 0; i < 50; i++) {
   
   
            InterpolData interp = new InterpolData();
            lon += Math.random();
            lat += Math.random();
            pValue += Math.random() * 50;
            interp.setLon(lon);
            interp.setLat(lat);
            interp.setPValue(pValue);
            listData.add(interp);
        }
        return listData;
    }


//生成等值线或等值面
    public FeatureCollection createequiSurface() {
   
   
        SimpleFeatureCollection fc = createFeatureCl('');
        Object geom = fc.features().next().getAttribute("the_geom");
        WKTReader2 wktReader = new WKTReader2();
        Geometry oldGeom = wktReader.read(geom.toString());
        FeatureCollection pfeatureCol = null;
        double _undefData = -9999.0;
        List<PolyLine> cPolylineList;
        List<Polygon> cPolygonList;
        int width = 100, height = 100;
        double[] _X = new double[width];
        double[] _Y = new double[height];
        double minX = fc.getBounds().getMinX();
        double minY = fc.getBounds().getMinY();
        double maxX = fc.getBounds().getMaxX();
        double maxY = fc.getBounds().getMaxY();
        Interpolate.createGridXY_Num(minX, minY, maxX, maxY, _X, _Y);

        double[][] _gridData;
        int nc =12;
        double[] dataInterval = {
   
   62, 65, 72, 75, 78, 81, 85, 90, 96, 100, 105, 110.9};

        double[][] trainData = trainData(createInterpolData());
        // IDW插值格网点
        _gridData = Interpolate.interpolation_IDW_Neighbor(trainData,
                _X, _Y, 12, _undefData);
        int[][] S1 = new int[_gridData.length][_gridData[0].length
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

紫雪giser

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值