use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testSnapToGrid.
@Test
public void testSnapToGrid() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_SnapToGrid(ST_GeomFromText('LINESTRING(1.1115678 2.123, 4.111111 3.2374897, 4.11112 3.23748667)'),.001))");
assertEquals("LINESTRING (1.112 2.123, 4.111 3.237)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testGeoJson.
@Test
public void testGeoJson() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJSON(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))'))))");
assertEquals("MULTIPOINT ((10 40), (40 30), (20 20), (30 10))", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
ex = TestFunctionResolving.getExpression("ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJSON(ST_GeomFromText('MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))'))))");
assertEquals("MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
ex = TestFunctionResolving.getExpression("ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJSON(ST_GeomFromText('LINESTRING (30 10, 10 30, 40 40)'))))");
assertEquals("LINESTRING (30 10, 10 30, 40 40)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testMakeEnvelope.
@Test
public void testMakeEnvelope() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_ASEWKT(st_makeenvelope(-1.73431370972209553,-0.71846435100548445,1.31749469692502075,1.28153564899451555,2908))");
assertEquals("SRID=2908;POLYGON ((-1.7343137097220955 -0.7184643510054844, -1.7343137097220955 1.2815356489945156, 1.3174946969250207 1.2815356489945156, 1.3174946969250207 -0.7184643510054844, -1.7343137097220955 -0.7184643510054844))", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testGeoJsonCollection.
@Test
public void testGeoJsonCollection() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsGeoJson(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))'))");
ClobType c = (ClobType) Evaluator.evaluate(ex);
assertEquals("{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[4.0,6.0]},{\"type\":\"LineString\",\"coordinates\":[[4.0,6.0],[7.0,10.0]]}]}", ClobType.getString(c));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testPolygon.
@Test
public void testPolygon() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_ASEWKT(ST_Polygon(ST_GeomFromText('LINESTRING(75.15 29.53,77 29,77.6 29.5, 75.15 29.53)'), 4326))");
assertEquals("SRID=4326;POLYGON ((75.15 29.53, 77 29, 77.6 29.5, 75.15 29.53))", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
Aggregations