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

Public Member Functions

Geometry read (String geometryLiteral)
 
String unparse (Geometry geom)
 

Static Public Attributes

static final String URI = POSTGIS.GeoURI
 The default WKT type URI. More...
 
static final GeoURIDatatype INSTANCE = new GeoURIDatatype()
 A static instance of WKTDatatype. More...
 

Member Function Documentation

◆ read()

Geometry read ( String  geometryLiteral)
21  {
22  String[] items=geometryLiteral.split(";");
23  if(items.length==0 || items.length>4) {
24  throw new AssertionError("Not a valid geoURI: " + geometryLiteral);
25  }
26  String[] coordinates=items[0].replace("geo:", "").split(",");
27  GeometryFactory fac=new GeometryFactory();
28  return fac.createPoint(new Coordinate(Double.valueOf(coordinates[0]),Double.valueOf(coordinates[1])));
29  }

◆ unparse()

String unparse ( Geometry  geom)
32  {
33  if("POINT".equalsIgnoreCase(geom.getGeometryType())) {
34  return "geo:"+geom.getCoordinate().x+","+geom.getCoordinate().y+";crs=EPSG:"+geom.getSRID();
35  }
36  return "geo:"+geom.getCentroid().getCoordinate().x+","+geom.getCentroid().getCoordinate().y+";crs=EPSG:"+geom.getSRID();
37  }

Member Data Documentation

◆ INSTANCE

final GeoURIDatatype INSTANCE = new GeoURIDatatype()
static

A static instance of WKTDatatype.

Referenced by LiteralRegistry.LiteralRegistry().

◆ URI

final String URI = POSTGIS.GeoURI
static

The default WKT type URI.

Referenced by LiteralRegistry.LiteralRegistry().