Search in sources :

Example 21 with GeometryCollection

use of org.locationtech.jts.geom.GeometryCollection in project yyl_example by Relucent.

the class JtsGeometryExample1 method createGeoCollect.

/**
 * create GeometryCollection contain point or multiPoint or line or multiLine or polygon or multiPolygon
 * @return 图形集
 * @throws ParseException
 */
public static GeometryCollection createGeoCollect() throws ParseException {
    LineString line = createLine();
    Polygon poly = createPolygonByWKT();
    Geometry g1 = GEOMETRY_FACTORY.createGeometry(line);
    Geometry g2 = GEOMETRY_FACTORY.createGeometry(poly);
    Geometry[] garray = new Geometry[] { g1, g2 };
    GeometryCollection gc = GEOMETRY_FACTORY.createGeometryCollection(garray);
    return gc;
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) GeometryCollection(org.locationtech.jts.geom.GeometryCollection) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) Polygon(org.locationtech.jts.geom.Polygon) MultiPolygon(org.locationtech.jts.geom.MultiPolygon)

Example 22 with GeometryCollection

use of org.locationtech.jts.geom.GeometryCollection in project arctic-sea by 52North.

the class GeoJSONTest method testGeometryCollectionWithZCoordinate.

@Test
public void testGeometryCollectionWithZCoordinate() throws GeoJSONDecodingException, IOException {
    GeometryCollection geometry = geometryFactory.createGeometryCollection(new Geometry[] { randomGeometryCollection(EPSG_4326), randomGeometryCollection(2000) });
    geometry.apply(new RandomZCoordinateFilter());
    geometry.geometryChanged();
    readWriteTest(geometry);
}
Also used : GeometryCollection(org.locationtech.jts.geom.GeometryCollection) Test(org.junit.Test)

Example 23 with GeometryCollection

use of org.locationtech.jts.geom.GeometryCollection in project arctic-sea by 52North.

the class GeoJSONTest method testCrs.

private void testCrs(int parent, int child) {
    final GeometryCollection col = geometryFactory.createGeometryCollection(new Geometry[] { randomPoint(child) });
    col.setSRID(parent);
    readWriteTest(col);
}
Also used : GeometryCollection(org.locationtech.jts.geom.GeometryCollection)

Aggregations

GeometryCollection (org.locationtech.jts.geom.GeometryCollection)23 Geometry (org.locationtech.jts.geom.Geometry)13 Point (org.locationtech.jts.geom.Point)7 LineString (org.locationtech.jts.geom.LineString)6 Polygon (org.locationtech.jts.geom.Polygon)6 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 MultiLineString (org.locationtech.jts.geom.MultiLineString)3 MultiPoint (org.locationtech.jts.geom.MultiPoint)3 MultiPolygon (org.locationtech.jts.geom.MultiPolygon)3 OGCConcreteGeometryCollection (com.esri.core.geometry.ogc.OGCConcreteGeometryCollection)2 OGCGeometry (com.esri.core.geometry.ogc.OGCGeometry)2 OGCGeometry.createFromEsriGeometry (com.esri.core.geometry.ogc.OGCGeometry.createFromEsriGeometry)2 GeometryType (com.facebook.presto.geospatial.GeometryType)2 GeometryUtils.jsonFromJtsGeometry (com.facebook.presto.geospatial.GeometryUtils.jsonFromJtsGeometry)2 GeometryUtils.wktFromJtsGeometry (com.facebook.presto.geospatial.GeometryUtils.wktFromJtsGeometry)2 Description (com.facebook.presto.spi.function.Description)2 ScalarFunction (com.facebook.presto.spi.function.ScalarFunction)2 SqlNullable (com.facebook.presto.spi.function.SqlNullable)2 SqlType (com.facebook.presto.spi.function.SqlType)2