rdf4j-postgis  Version 0.1.0.0
GeoHashDatatype Class Reference

WKTDatatype class allows the URI "geo:wktLiteral" to be used as a datatype and it will parse that datatype to a JTS Geometry. More...

Inheritance diagram for GeoHashDatatype:
Collaboration diagram for GeoHashDatatype:

Public Member Functions

String unparse (Geometry geom1)
 This method Un-parses the JTS Geometry to the WKT literal. More...
 
Geometry read (String geometryLiteral)
 
String toString ()
 

Static Public Attributes

static final String URI = POSTGIS.NAMESPACE+POSTGIS.GeoHash
 The default WKT type URI. More...
 
static final GeoHashDatatype INSTANCE = new GeoHashDatatype()
 A static instance of WKTDatatype. More...
 
static final IRI LiteralIRI =SimpleValueFactory.getInstance().createIRI(POSTGIS.NAMESPACE+POSTGIS.GeoHash)
 

Detailed Description

WKTDatatype class allows the URI "geo:wktLiteral" to be used as a datatype and it will parse that datatype to a JTS Geometry.

Req 10 All RDFS Literals of type geo:wktLiteral shall consist of an optional URI identifying the coordinate reference system followed by Simple Features Well Known Text (WKT) describing a geometric value. Valid geo:wktLiterals are formed by concatenating a valid, absolute URI as defined in [RFC 2396], one or more spaces (Unicode U+0020 character) as a separator, and a WKT string as defined in Simple Features [ISO 19125-1].

Req 11 The URI

<http://www.opengis.net/def/crs/OGC/1.3/CRS84>

shall be assumed as the spatial reference system for geo:wktLiterals that do not * specify an explicit spatial reference system URI.

Member Function Documentation

◆ read()

Geometry read ( String  geometryLiteral)

Reimplemented from VectorLiteral.

80  {
81  GeoHash hash=GeoHash.fromGeohashString(geometryLiteral);
82  Coordinate coord=new Coordinate(hash.getOriginatingPoint().getLatitude(), hash.getOriginatingPoint().getLongitude());
83  List<Coordinate> coords=new LinkedList<Coordinate>();
84  coords.add(coord);
85  return LiteralUtils.createGeometry(coords, "Point", 4326);
86  }

References LiteralUtils.createGeometry().

◆ toString()

String toString ( )
90  {
91  return "GeoHashDatatype{" + URI + '}';
92  }
static final String URI
The default WKT type URI.
Definition: GeoHashDatatype.java:52

References GeoHashDatatype.URI.

◆ unparse()

String unparse ( Geometry  geom1)

This method Un-parses the JTS Geometry to the WKT literal.

Parameters
geometry- the JTS Geometry to be un-parsed
Returns
WKT - the returned WKT Literal.
Notice that the Spatial Reference System is not specified in returned WKT literal.

Reimplemented from VectorLiteral.

71  {
72  if(geom1.getGeometryType().equalsIgnoreCase("Point")) {
73  return GeoHash.geoHashStringWithCharacterPrecision(geom1.getCoordinate().getY(), geom1.getCoordinate().getX(), 32);
74  }else {
75  return GeoHash.geoHashStringWithCharacterPrecision(geom1.getCentroid().getCoordinate().getY(), geom1.getCentroid().getCoordinate().getX(), 32);
76  }
77  }

Referenced by AsGeoHash.operation().

Member Data Documentation

◆ INSTANCE

final GeoHashDatatype INSTANCE = new GeoHashDatatype()
static

A static instance of WKTDatatype.

Referenced by AsGeoHash.operation().

◆ LiteralIRI

final IRI LiteralIRI =SimpleValueFactory.getInstance().createIRI(POSTGIS.NAMESPACE+POSTGIS.GeoHash)
static

◆ URI

final String URI = POSTGIS.NAMESPACE+POSTGIS.GeoHash
static

The default WKT type URI.

Referenced by GeoHashDatatype.toString().