Search in sources :

Example 66 with GeometryFactory

use of com.vividsolutions.jts.geom.GeometryFactory 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 67 with GeometryFactory

use of com.vividsolutions.jts.geom.GeometryFactory in project tutorials by eugenp.

the class ShapeFile method main.

public static void main(String[] args) throws Exception {
    DefaultFeatureCollection collection = new DefaultFeatureCollection();
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
    SimpleFeatureType TYPE = DataUtilities.createType("Location", "location:Point:srid=4326," + "name:String");
    SimpleFeatureType CITY = createFeatureType();
    addLocations(CITY, collection);
    File shapeFile = getNewShapeFile();
    ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    ShapefileDataStore dataStore = setDataStoreParams(dataStoreFactory, params, shapeFile, CITY);
    writeToFile(dataStore, collection);
}
Also used : Serializable(java.io.Serializable) GeometryFactory(com.vividsolutions.jts.geom.GeometryFactory) ShapefileDataStore(org.geotools.data.shapefile.ShapefileDataStore) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) HashMap(java.util.HashMap) ShapefileDataStoreFactory(org.geotools.data.shapefile.ShapefileDataStoreFactory) File(java.io.File) DefaultFeatureCollection(org.geotools.feature.DefaultFeatureCollection)

Aggregations

GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)67 Coordinate (com.vividsolutions.jts.geom.Coordinate)44 Test (org.junit.Test)25 Geometry (com.vividsolutions.jts.geom.Geometry)20 ArrayList (java.util.ArrayList)20 LineString (com.vividsolutions.jts.geom.LineString)17 SimpleFeature (org.opengis.feature.simple.SimpleFeature)13 File (java.io.File)10 IntersectionVertex (org.opentripplanner.routing.vertextype.IntersectionVertex)10 Point (com.vividsolutions.jts.geom.Point)9 List (java.util.List)8 SimpleFeatureBuilder (org.geotools.feature.simple.SimpleFeatureBuilder)8 RevFeatureType (org.locationtech.geogig.api.RevFeatureType)8 Optional (com.google.common.base.Optional)7 Polygon (com.vividsolutions.jts.geom.Polygon)7 Metacard (ddf.catalog.data.Metacard)7 RevFeature (org.locationtech.geogig.api.RevFeature)7 ImmutableList (com.google.common.collect.ImmutableList)6 LinearRing (com.vividsolutions.jts.geom.LinearRing)6 GeometryOperator (org.codice.alliance.libs.klv.GeometryOperator)6