Search in sources :

Example 6 with WKBWriter

use of com.vividsolutions.jts.io.WKBWriter in project teiid by teiid.

the class TestGeometry method testEwkbZCooridinate.

@Test(expected = ExpressionEvaluationException.class)
public void testEwkbZCooridinate() throws Exception {
    WKBWriter writer = new WKBWriter(3, true);
    GeometryFactory gf = new GeometryFactory();
    Point point = gf.createPoint(new Coordinate(0, 0, 0));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writer.write(point, new OutputStreamOutStream(baos));
    Expression ex1 = TestFunctionResolving.getExpression("ST_GeomFromBinary(X'" + new BinaryType(baos.toByteArray()) + "', 8307)");
    Evaluator.evaluate(ex1);
}
Also used : WKBWriter(com.vividsolutions.jts.io.WKBWriter) GeometryFactory(com.vividsolutions.jts.geom.GeometryFactory) BinaryType(org.teiid.core.types.BinaryType) Coordinate(com.vividsolutions.jts.geom.Coordinate) Expression(org.teiid.query.sql.symbol.Expression) Point(com.vividsolutions.jts.geom.Point) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStreamOutStream(com.vividsolutions.jts.io.OutputStreamOutStream) Test(org.junit.Test)

Example 7 with WKBWriter

use of com.vividsolutions.jts.io.WKBWriter in project hibernate-orm by hibernate.

the class TestHANASpatialFunctions method geomfromwkb.

public void geomfromwkb(String pckg) throws SQLException {
    WKBWriter writer = new WKBWriter(2, false);
    byte[] wkb = writer.write(expectationsFactory.getTestPolygon());
    Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromWKB(wkb);
    String hql = format("SELECT 1, cast(geomfromwkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", getGeometryTypeFromPackage(pckg), pckg);
    Map<String, Object> params = createQueryParams("param", wkb);
    retrieveHQLResultsAndCompare(dbexpected, hql, params, pckg);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKBWriter(com.vividsolutions.jts.io.WKBWriter)

Aggregations

WKBWriter (com.vividsolutions.jts.io.WKBWriter)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 OutputStreamOutStream (com.vividsolutions.jts.io.OutputStreamOutStream)4 Coordinate (com.vividsolutions.jts.geom.Coordinate)3 Geometry (com.vividsolutions.jts.geom.Geometry)3 IOException (java.io.IOException)3 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)2 Point (com.vividsolutions.jts.geom.Point)2 Test (org.junit.Test)2 BinaryType (org.teiid.core.types.BinaryType)2 Expression (org.teiid.query.sql.symbol.Expression)2 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 ORecordBytes (com.orientechnologies.orient.core.record.impl.ORecordBytes)1 DefaultGeometryProperty (eu.esdihumboldt.hale.common.instance.geometry.DefaultGeometryProperty)1 GeometryProperty (eu.esdihumboldt.hale.common.schema.geometry.GeometryProperty)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1