kiwi-postgis  Version 0.1.0.0
GeomFromGeoHash Class Reference
Inheritance diagram for GeomFromGeoHash:
Collaboration diagram for GeomFromGeoHash:

Public Member Functions

Geometry construct (String input)
 
String getURI ()
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Member Function Documentation

◆ construct()

Geometry construct ( String  input)

References LiteralUtils.createGeometry().

18  {
19  GeoHash hash=GeoHash.fromGeohashString(input);
20  Coordinate coord=new Coordinate(hash.getOriginatingPoint().getLatitude(), hash.getOriginatingPoint().getLongitude());
21  List<Coordinate> coords=new LinkedList<Coordinate>();
22  coords.add(coord);
23  return LiteralUtils.createGeometry(coords, "Point", 4326);
24  }

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited

References GeometricConstructor.construct(), and LiteralRegistry.getLiteral().

16  {
17  if (args.length != 1) {
18  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
19  }
20  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
21  String geomString = args[0].stringValue();
22  Geometry result = construct(geomString);
23  return valueFactory.createLiteral(((VectorLiteral) l).unparse(result),((Literal)args[0]).getDatatype());
24  }

◆ getURI()

String getURI ( )

References POSTGIS.st_geomFromGeoHash.

27  {
28  return POSTGIS.st_geomFromGeoHash.stringValue();
29  }