Examples of TPSInterpolation


Examples of org.geotools.referencing.operation.builder.algorithm.TPSInterpolation

            pointsAndValues.put(new DirectPosition2D(crs, 45, 708), -9.5);
            pointsAndValues.put(new DirectPosition2D(crs, 905, 350), 17.5);
            pointsAndValues.put(new DirectPosition2D(crs, 905, 850), -45.5);

            //now we can construct the Interpolation Object 
            TPSInterpolation interpolation = new TPSInterpolation(pointsAndValues, 2, 2, env);

            // we can get and show coverage
            (new GridCoverageFactory()).create("Intepolated Coverage", interpolation.get2DGrid(),
                env).show();

            // or we can interpolate value in any DirectPosition
            System.out.print(interpolation.getValue(new DirectPosition2D(12.34, 15.123)));

            /* AbstractInterpolation interpoaltion = new TPSInterpolation(
               generatePositionsWithValues(env,15, 5),
               env.getLength(0)/500,
               env.getLength(1)/500,
               env);*/
            (new GridCoverageFactory()).create("Intepoalted Coverage", interpolation.get2DGrid(),
                env).show();

            AbstractInterpolation interp = new TPSInterpolation(generatePositionsWithValues(env,
                        15, 5));
           
            Color[] colors = new Color[] {Color.BLUE, Color.CYAN, Color.WHITE, Color.YELLOW, Color.RED};         
            GridCoverage2D c= (new GridCoverageFactory()).create("Intepolated Coverage",  interpolation.getRaster (), interpolation.getEnv(),
                                                    null, null, null, new Color[][] {colors}, null);
View Full Code Here

Examples of org.geotools.referencing.operation.builder.algorithm.TPSInterpolation

      pointsAndValues.put(c,  new Float(-9.54456));
      pointsAndValues.put(d,  new Float(7.2345));


      //now we can construct the Interpolation Object
      TPSInterpolation interp = new TPSInterpolation(pointsAndValues, 100, 100, env);


       // We can create and show a coverage image of the interpolation within the Envelope
      GridCoverageFactory gcf = new GridCoverageFactory();
      GridCoverage2D coverage = gcf.create("Intepolated Coverage",  interp.get2DGrid(), env);//.show();
     
     
      //Assert.assertEquals( Double.parseDouble((coverage.evaluate(a, (Set)(new HashSet())).iterator().next()).toString()), pointsAndValues.get(a).floatValue(), 0.01);
      Assert.assertEquals( coverage.evaluate(a, new float[1])[0], pointsAndValues.get(a).floatValue(), 0.01);
     
     
      // We can also get interpolated value at any DirectPosition
      float myValue = interp.getValue(a);
      Assert.assertEquals( interp.getValue(a), pointsAndValues.get(a).floatValue(), 0.0);       
      Assert.assertEquals( interp.getValue(b), pointsAndValues.get(b).floatValue(), 0.0);
      Assert.assertEquals( interp.getValue(c), pointsAndValues.get(c).floatValue(), 0.0);
      Assert.assertEquals( interp.getValue(d), pointsAndValues.get(d).floatValue(), 0.0);
      
     
    }
View Full Code Here

Examples of org.geotools.referencing.operation.builder.algorithm.TPSInterpolation

  
    @Override
    protected float[] computeWarpGrid(GridParameters gridParams)
        throws TransformException, FactoryException {
     
      TPSInterpolation dxInterpolation = new TPSInterpolation(buildPositionsMap(0, 3600));
      TPSInterpolation dyInterpolation = new TPSInterpolation(buildPositionsMap(1, 3600));
     
        return interpolateWarpGrid(gridParams, dxInterpolation, dyInterpolation);
    }
View Full Code Here

Examples of org.geotools.referencing.operation.builder.algorithm.TPSInterpolation

    }

    protected float[] computeWarpGrid(GridParameters gridParams)
        throws TransformException {
     
      TPSInterpolation dxInterpolation = new TPSInterpolation(buildPositionsMap(0));
      TPSInterpolation dyInterpolation = new TPSInterpolation(buildPositionsMap(1));
     
        return interpolateWarpGrid(gridParams, dxInterpolation, dyInterpolation);           
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.