rdf4j-postgis  Version 0.1.0.0
GeomFromGeoHash Class Reference

Returns a geometry from a GeoHash String. More...

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
 

Detailed Description

Returns a geometry from a GeoHash String.

Member Function Documentation

◆ construct()

Geometry construct ( String  input)

Reimplemented from GeometricConstructor.

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

References LiteralUtils.createGeometry().

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited
17  {
18  if (args.length != 1) {
19  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
20  }
21  String geomString = args[0].stringValue();
22  Geometry result = construct(geomString);
23  return valueFactory.createLiteral(WKTDatatype.INSTANCE.unparse(result), WKTDatatype.LiteralIRI);
24  }

References GeometricConstructor.construct(), WKTDatatype.INSTANCE, WKTDatatype.LiteralIRI, and WKTDatatype.unparse().

Referenced by GeomFromGeoJSONTest.testGeomFromGeoJSON(), GeomFromTextTest.testGeomFromText(), GeomFromWKBTest.testGeomFromWKB(), MakeLineTest.testMakeLine1(), MakePointTest.testMakePoint1(), MakePointTest.testMakePointXYZ(), PointFromTextTest.testPointFromText(), and PolygonFromTextTest.testPolygonFromText().

◆ getURI()

String getURI ( )
30  {
31  return POSTGIS.st_geomFromGeoHash.stringValue();
32  }

References POSTGIS.st_geomFromGeoHash.