use of org.teiid.core.types.GeometryType in project teiid by teiid.
the class TestGeometry method testGmlParseSrid.
@Test
public void testGmlParseSrid() throws Exception {
String gml = "<gml:Polygon srsName=\"SDO:8307\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal=\".\" cs=\",\" ts=\" \">5,1 8,1 8,6 5,7 5,1 </gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>";
GeometryType gt = GeometryUtils.geometryFromGml(new ClobType(ClobImpl.createClob(gml.toCharArray())), null);
assertEquals(8307, gt.getSrid());
// oracle will leave of the int with unknown
gml = "<gml:Polygon srsName=\"SDO:\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal=\".\" cs=\",\" ts=\" \">5,1 8,1 8,6 5,7 5,1 </gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>";
gt = GeometryUtils.geometryFromGml(new ClobType(ClobImpl.createClob(gml.toCharArray())), null);
assertEquals(GeometryType.UNKNOWN_SRID, gt.getSrid());
}
use of org.teiid.core.types.GeometryType in project teiid by teiid.
the class TestJDBCSocketTransport method testGeometryStreaming.
@Test
public void testGeometryStreaming() throws Exception {
StringBuilder geomString = new StringBuilder();
for (int i = 0; i < 600; i++) {
geomString.append("100 100,");
}
geomString.append("100 100");
final GeometryType geo = GeometryUtils.geometryFromClob(new ClobType(new ClobImpl("POLYGON ((" + geomString + "))")));
long length = geo.length();
PreparedStatement s = conn.prepareStatement("select st_geomfrombinary(?)");
s.setBlob(1, new BlobImpl(new InputStreamFactory() {
@Override
public InputStream getInputStream() throws IOException {
try {
return geo.getBinaryStream();
} catch (SQLException e) {
throw new IOException(e);
}
}
}));
ResultSet rs = s.executeQuery();
rs.next();
Blob b = rs.getBlob(1);
assertEquals(length, b.length());
b.getBytes(1, (int) b.length());
toggleInline(false);
rs = s.executeQuery();
rs.next();
b = rs.getBlob(1);
assertEquals(length, b.length());
b.getBytes(1, (int) b.length());
}
Aggregations