rdf4j-postgis  Version 0.1.0.0
RasterToWorldCoordY Class Reference
Inheritance diagram for RasterToWorldCoordY:
Collaboration diagram for RasterToWorldCoordY:

Public Member Functions

String getURI ()
 
Double attribute (GridCoverage raster, Integer longitude, Integer latitude)
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Member Function Documentation

◆ attribute()

Double attribute ( GridCoverage  raster,
Integer  longitude,
Integer  latitude 
)

Reimplemented from RasterAttributeIntIntDoubleFunction.

22  {
23  try {
24  GridGeometry gg2D = raster.getGridGeometry();
25  MathTransform gridToCRS = gg2D.getGridToCRS(PixelInCell.CELL_CENTER);
26  DirectPosition realPos=new DirectPosition2D(latitude, longitude);
27  DirectPosition gridPos = new DirectPosition2D();
28  DirectPosition res=gridToCRS.transform(realPos, gridPos);
29  Coordinate coord=new Coordinate(res.getCoordinate()[0],res.getCoordinate()[1]);
30  return coord.y;
31  } catch (TransformException e) {
32  return (Double) null;
33  }
34  }

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited
17  {
18  if (args.length != 3) {
19  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
20  }
21  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
22  if(l instanceof RasterLiteral) {
23  GridCoverage geom=((RasterLiteral)l).read(args[0].stringValue());
24  Integer longitude = Integer.valueOf(args[1].stringValue());
25  Integer latitude = Integer.valueOf(args[2].stringValue());
26  Double result = attribute(geom,longitude,latitude);
27  return valueFactory.createLiteral(result);
28  }
29  return null;
30  }
abstract Double attribute(GridCoverage geom, Integer longitude, Integer latitude)

References RasterAttributeIntIntDoubleFunction.attribute(), and LiteralRegistry.getLiteral().

Referenced by RasterToWorldCoordXTest.testRasterToWorldCoordX(), RasterToWorldCoordYTest.testRasterToWorldCoordY(), WorldToRasterCoordXTest.testWorldToRasterCoordX(), and WorldToRasterCoordYTest.testWorldToRasterCoordY().

◆ getURI()

String getURI ( )
17  {
18  return POSTGIS.st_rasterToWorldCoordY.stringValue();
19  }

References POSTGIS.st_rasterToWorldCoordY.