kiwi-postgis  Version 0.1.0.0
TWKBDatatype 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 TWKBDatatype:
Collaboration diagram for TWKBDatatype:

Classes

class  WKBTextSRS
 

Public Member Functions

String unparse (Geometry geometry)
 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.TWKB
 The default WKT type URI. More...
 
static final TWKBDatatype INSTANCE = new TWKBDatatype()
 A static instance of WKTDatatype. More...
 

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)

References LiteralUtils.createGeometry(), TWKBDatatype.WKBTextSRS.getWkbText(), and TWKBReader.read().

55  {
56  WKBTextSRS wkbTextSRS = new WKBTextSRS(geometryLiteral);
57 
58  TWKBReader wkbReader = new TWKBReader();
59  Geometry geometry;
60  try {
61  geometry = wkbReader.read(wkbTextSRS.getWkbText().getBytes());
62  return LiteralUtils.createGeometry(geometry.getCoordinates(), geometry.getGeometryType(), geometry.getSRID());
63  } catch (ParseException e) {
64  // TODO Auto-generated catch block
65  e.printStackTrace();
66  throw new RuntimeException();
67  }
68 
69 
70  }

◆ toString()

String toString ( )
103  {
104  return "TWKBDatatype{" + URI + '}';
105  }
static final String URI
The default WKT type URI.
Definition: TWKBDatatype.java:32

◆ unparse()

String unparse ( Geometry  geometry)

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.

References TWKBWriter.write().

49  {
50  TWKBWriter writer=new TWKBWriter();
51  return writer.write(geometry).toString();
52  }

Member Data Documentation

◆ INSTANCE

final TWKBDatatype INSTANCE = new TWKBDatatype()
static

A static instance of WKTDatatype.

Referenced by LiteralRegistry.LiteralRegistry().

◆ URI

final String URI = POSTGIS.TWKB
static

The default WKT type URI.

Referenced by LiteralRegistry.LiteralRegistry().