Search in sources :

Example 86 with FeatureCollection

use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.

the class UnionTest method buildFeatureUnionList.

private static FeatureCollection buildFeatureUnionList() throws FactoryException {
    type = createSimpleType2();
    final FeatureCollection featureList = FeatureStoreUtilities.collection("noname", type);
    Feature myFeature1 = type.newInstance();
    LinearRing ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(4.0, 4.0), new Coordinate(4.0, 8.0), new Coordinate(7.0, 8.0), new Coordinate(7.0, 4.0), new Coordinate(4.0, 4.0) });
    myFeature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-11");
    myFeature1.setPropertyValue("name", "feature11");
    myFeature1.setPropertyValue("color", "red");
    myFeature1.setPropertyValue("geom3", geometryFactory.createPolygon(ring, null));
    myFeature1.setPropertyValue("att", 20);
    featureList.add(myFeature1);
    Feature myFeature2 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(7.0, 4.0), new Coordinate(7.0, 8.0), new Coordinate(9.0, 8.0), new Coordinate(9.0, 4.0), new Coordinate(7.0, 4.0) });
    myFeature2.setPropertyValue(AttributeConvention.IDENTIFIER, "id-12");
    myFeature2.setPropertyValue("name", "feature12");
    myFeature2.setPropertyValue("color", "blue");
    myFeature2.setPropertyValue("geom3", geometryFactory.createPolygon(ring, null));
    myFeature2.setPropertyValue("att", 20);
    featureList.add(myFeature2);
    Feature myFeature3 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(6.0, 2.0), new Coordinate(6.0, 4.0), new Coordinate(9.0, 4.0), new Coordinate(9.0, 2.0), new Coordinate(6.0, 2.0) });
    myFeature3.setPropertyValue(AttributeConvention.IDENTIFIER, "id-13");
    myFeature3.setPropertyValue("name", "feature13");
    myFeature3.setPropertyValue("color", "grey");
    myFeature3.setPropertyValue("geom3", geometryFactory.createPolygon(ring, null));
    myFeature3.setPropertyValue("att", 10);
    featureList.add(myFeature3);
    Feature myFeature4 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(4.0, 2.0), new Coordinate(4.0, 3.0), new Coordinate(5.0, 3.0), new Coordinate(5.0, 2.0), new Coordinate(4.0, 2.0) });
    myFeature4.setPropertyValue(AttributeConvention.IDENTIFIER, "id-14");
    myFeature4.setPropertyValue("name", "feature14");
    myFeature4.setPropertyValue("color", "grey");
    myFeature4.setPropertyValue("geom3", geometryFactory.createPolygon(ring, null));
    myFeature4.setPropertyValue("att", 12);
    featureList.add(myFeature4);
    Feature myFeature5 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(2.0, 5.0), new Coordinate(2.0, 6.0), new Coordinate(3.0, 6.0), new Coordinate(3.0, 5.0), new Coordinate(2.0, 5.0) });
    myFeature5.setPropertyValue(AttributeConvention.IDENTIFIER, "id-15");
    myFeature5.setPropertyValue("name", "feature15");
    myFeature5.setPropertyValue("color", "grey");
    myFeature5.setPropertyValue("geom3", geometryFactory.createPolygon(ring, null));
    myFeature5.setPropertyValue("att", 12);
    featureList.add(myFeature5);
    return featureList;
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) Coordinate(org.locationtech.jts.geom.Coordinate) LinearRing(org.locationtech.jts.geom.LinearRing) Feature(org.opengis.feature.Feature)

Example 87 with FeatureCollection

use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.

the class UnionTest method buildFeatureList.

private static FeatureCollection buildFeatureList() throws FactoryException {
    type = createSimpleType();
    final FeatureCollection featureList = FeatureStoreUtilities.collection("noname", type);
    Feature myFeature1 = type.newInstance();
    LinearRing ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(3.0, 5.0), new Coordinate(3.0, 7.0), new Coordinate(6.0, 7.0), new Coordinate(6.0, 5.0), new Coordinate(3.0, 5.0) });
    myFeature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-01");
    myFeature1.setPropertyValue("name", "feature1");
    myFeature1.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
    featureList.add(myFeature1);
    Feature myFeature2 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(6.0, 5.0), new Coordinate(6.0, 7.0), new Coordinate(8.0, 7.0), new Coordinate(8.0, 5.0), new Coordinate(6.0, 5.0) });
    myFeature2.setPropertyValue(AttributeConvention.IDENTIFIER, "id-02");
    myFeature2.setPropertyValue("name", "feature2");
    myFeature2.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
    featureList.add(myFeature2);
    Feature myFeature3 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(6.0, 2.0), new Coordinate(6.0, 5.0), new Coordinate(8.0, 5.0), new Coordinate(8.0, 2.0), new Coordinate(6.0, 2.0) });
    myFeature3.setPropertyValue(AttributeConvention.IDENTIFIER, "id-03");
    myFeature3.setPropertyValue("name", "feature3");
    myFeature3.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
    // sfb.set("geom2", line);
    featureList.add(myFeature3);
    Feature myFeature4 = type.newInstance();
    ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(2.0, 3.0), new Coordinate(2.0, 4.0), new Coordinate(3.0, 4.0), new Coordinate(3.0, 3.0), new Coordinate(2.0, 3.0) });
    myFeature4.setPropertyValue(AttributeConvention.IDENTIFIER, "id-04");
    myFeature4.setPropertyValue("name", "feature4");
    myFeature4.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
    featureList.add(myFeature4);
    return featureList;
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) Coordinate(org.locationtech.jts.geom.Coordinate) LinearRing(org.locationtech.jts.geom.LinearRing) Feature(org.opengis.feature.Feature)

Example 88 with FeatureCollection

use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.

the class MergeProcess method execute.

/**
 *  {@inheritDoc }
 */
@Override
protected void execute() {
    final FeatureCollection[] inputFeaturesList = inputParameters.getValue(FEATURES_IN);
    final FeatureCollection firstFC = inputFeaturesList[0];
    final FeatureCollection resultFeatureList = new MergeFeatureCollection(inputFeaturesList, firstFC);
    outputParameters.getOrCreate(FEATURE_OUT).setValue(resultFeatureList);
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection)

Example 89 with FeatureCollection

use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.

the class AffineTransformTest method buildResultList.

private static FeatureCollection buildResultList() throws FactoryException {
    type = createSimpleType();
    final FeatureCollection featureList = FeatureStoreUtilities.collection("", type);
    Feature myFeature1;
    LinearRing ring = GF.createLinearRing(new Coordinate[] { new Coordinate(103.0, 103.0), new Coordinate(103.0, 104.0), new Coordinate(104.0, 104.0), new Coordinate(104.0, 103.0), new Coordinate(103.0, 103.0) });
    myFeature1 = type.newInstance();
    myFeature1.setPropertyValue("sis:identifier", "id-01");
    myFeature1.setPropertyValue("color", "grey");
    myFeature1.setPropertyValue("height", 9);
    myFeature1.setPropertyValue("type", "church");
    myFeature1.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature1.setPropertyValue("geom2", GF.createPoint(new Coordinate(103.5, 103.5)));
    featureList.add(myFeature1);
    Feature myFeature2;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(105.0, 106.0), new Coordinate(105.0, 107.0), new Coordinate(106.0, 107.0), new Coordinate(106.0, 106.0), new Coordinate(105.0, 106.0) });
    MultiPoint multPt = GF.createMultiPoint(new Coordinate[] { new Coordinate(105.0, 104.0), new Coordinate(103.0, 106.0), new Coordinate(104.0, 107.0), new Coordinate(105.5, 106.5) });
    myFeature2 = type.newInstance();
    myFeature2.setPropertyValue("sis:identifier", "id-02");
    myFeature2.setPropertyValue("color", "blue");
    myFeature2.setPropertyValue("height", 3);
    myFeature2.setPropertyValue("type", "office");
    myFeature2.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature2.setPropertyValue("geom2", multPt);
    featureList.add(myFeature2);
    Feature myFeature3;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(109.0, 104.0), new Coordinate(109.0, 105.0), new Coordinate(111.0, 105.0), new Coordinate(111.0, 104.0), new Coordinate(109.0, 104.0) });
    LineString line = GF.createLineString(new Coordinate[] { new Coordinate(107.0, 100.0), new Coordinate(109.0, 103.0) });
    myFeature3 = type.newInstance();
    myFeature3.setPropertyValue("sis:identifier", "id-03");
    myFeature3.setPropertyValue("color", "black");
    myFeature3.setPropertyValue("height", 2);
    myFeature3.setPropertyValue("type", "office");
    myFeature3.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature3.setPropertyValue("geom2", line);
    featureList.add(myFeature3);
    Feature myFeature4;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(102.0, 102.0), new Coordinate(102.0, 103.0), new Coordinate(103.0, 103.0), new Coordinate(103.0, 102.0), new Coordinate(102.0, 102.0) });
    myFeature4 = type.newInstance();
    myFeature4.setPropertyValue("sis:identifier", "id-04");
    myFeature4.setPropertyValue("color", "yellow");
    myFeature4.setPropertyValue("height", 2);
    myFeature4.setPropertyValue("type", "post office");
    myFeature4.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature4.setPropertyValue("geom2", GF.createPoint(new Coordinate(110, 105)));
    featureList.add(myFeature4);
    Feature myFeature5;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(106.0, 107.0), new Coordinate(106.0, 108.0), new Coordinate(107.0, 108.0), new Coordinate(107.0, 107.0), new Coordinate(106.0, 107.0) });
    line = GF.createLineString(new Coordinate[] { new Coordinate(108.0, 100.0), new Coordinate(105.0, 103.0) });
    myFeature5 = type.newInstance();
    myFeature5.setPropertyValue("sis:identifier", "id-05");
    myFeature5.setPropertyValue("color", "yellow");
    myFeature5.setPropertyValue("height", 9);
    myFeature5.setPropertyValue("type", "office");
    myFeature5.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature5.setPropertyValue("geom2", line);
    featureList.add(myFeature5);
    Feature myFeature6;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(115.0, 110.0), new Coordinate(115.0, 111.0), new Coordinate(116.0, 111.0), new Coordinate(116.0, 110.0), new Coordinate(115.0, 110.0) });
    LinearRing ring2 = GF.createLinearRing(new Coordinate[] { new Coordinate(108.0, 100.0), new Coordinate(109.0, 106.0), new Coordinate(110.0, 102.0), new Coordinate(108.0, 100.0) });
    myFeature6 = type.newInstance();
    myFeature6.setPropertyValue("sis:identifier", "id-06");
    myFeature6.setPropertyValue("color", "black");
    myFeature6.setPropertyValue("height", 2);
    myFeature6.setPropertyValue("type", "church");
    myFeature6.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature6.setPropertyValue("geom2", GF.createPolygon(ring2, null));
    featureList.add(myFeature6);
    return featureList;
}
Also used : MultiPoint(org.locationtech.jts.geom.MultiPoint) FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) Coordinate(org.locationtech.jts.geom.Coordinate) LineString(org.locationtech.jts.geom.LineString) LinearRing(org.locationtech.jts.geom.LinearRing) Feature(org.opengis.feature.Feature)

Example 90 with FeatureCollection

use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.

the class AffineTransformTest method buildFeatureList.

private static FeatureCollection buildFeatureList() throws FactoryException {
    type = createSimpleType();
    final FeatureCollection featureList = FeatureStoreUtilities.collection("", type);
    Feature myFeature1;
    LinearRing ring = GF.createLinearRing(new Coordinate[] { new Coordinate(3.0, 3.0), new Coordinate(3.0, 4.0), new Coordinate(4.0, 4.0), new Coordinate(4.0, 3.0), new Coordinate(3.0, 3.0) });
    myFeature1 = type.newInstance();
    myFeature1.setPropertyValue("sis:identifier", "id-01");
    myFeature1.setPropertyValue("color", "grey");
    myFeature1.setPropertyValue("height", 9);
    myFeature1.setPropertyValue("type", "church");
    myFeature1.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature1.setPropertyValue("geom2", GF.createPoint(new Coordinate(3.5, 3.5)));
    featureList.add(myFeature1);
    Feature myFeature2;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(5.0, 6.0), new Coordinate(5.0, 7.0), new Coordinate(6.0, 7.0), new Coordinate(6.0, 6.0), new Coordinate(5.0, 6.0) });
    MultiPoint multPt = GF.createMultiPoint(new Coordinate[] { new Coordinate(5.0, 4.0), new Coordinate(3.0, 6.0), new Coordinate(4.0, 7.0), new Coordinate(5.5, 6.5) });
    myFeature2 = type.newInstance();
    myFeature2.setPropertyValue("sis:identifier", "id-02");
    myFeature2.setPropertyValue("color", "blue");
    myFeature2.setPropertyValue("height", 3);
    myFeature2.setPropertyValue("type", "office");
    myFeature2.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature2.setPropertyValue("geom2", multPt);
    featureList.add(myFeature2);
    Feature myFeature3;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(9.0, 4.0), new Coordinate(9.0, 5.0), new Coordinate(11.0, 5.0), new Coordinate(11.0, 4.0), new Coordinate(9.0, 4.0) });
    LineString line = GF.createLineString(new Coordinate[] { new Coordinate(7.0, 0.0), new Coordinate(9.0, 3.0) });
    myFeature3 = type.newInstance();
    myFeature3.setPropertyValue("sis:identifier", "id-03");
    myFeature3.setPropertyValue("color", "black");
    myFeature3.setPropertyValue("height", 2);
    myFeature3.setPropertyValue("type", "office");
    myFeature3.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature3.setPropertyValue("geom2", line);
    featureList.add(myFeature3);
    Feature myFeature4;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(2.0, 2.0), new Coordinate(2.0, 3.0), new Coordinate(3.0, 3.0), new Coordinate(3.0, 2.0), new Coordinate(2.0, 2.0) });
    myFeature4 = type.newInstance();
    myFeature4.setPropertyValue("sis:identifier", "id-04");
    myFeature4.setPropertyValue("color", "yellow");
    myFeature4.setPropertyValue("height", 2);
    myFeature4.setPropertyValue("type", "post office");
    myFeature4.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature4.setPropertyValue("geom2", GF.createPoint(new Coordinate(10, 5)));
    featureList.add(myFeature4);
    Feature myFeature5;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(6.0, 7.0), new Coordinate(6.0, 8.0), new Coordinate(7.0, 8.0), new Coordinate(7.0, 7.0), new Coordinate(6.0, 7.0) });
    line = GF.createLineString(new Coordinate[] { new Coordinate(8.0, 0.0), new Coordinate(5.0, 3.0) });
    myFeature5 = type.newInstance();
    myFeature5.setPropertyValue("sis:identifier", "id-05");
    myFeature5.setPropertyValue("color", "yellow");
    myFeature5.setPropertyValue("height", 9);
    myFeature5.setPropertyValue("type", "office");
    myFeature5.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature5.setPropertyValue("geom2", line);
    featureList.add(myFeature5);
    Feature myFeature6;
    ring = GF.createLinearRing(new Coordinate[] { new Coordinate(15.0, 10.0), new Coordinate(15.0, 11.0), new Coordinate(16.0, 11.0), new Coordinate(16.0, 10.0), new Coordinate(15.0, 10.0) });
    LinearRing ring2 = GF.createLinearRing(new Coordinate[] { new Coordinate(8.0, 0.0), new Coordinate(9.0, 6.0), new Coordinate(10.0, 2.0), new Coordinate(8.0, 0.0) });
    myFeature6 = type.newInstance();
    myFeature6.setPropertyValue("sis:identifier", "id-06");
    myFeature6.setPropertyValue("color", "black");
    myFeature6.setPropertyValue("height", 2);
    myFeature6.setPropertyValue("type", "church");
    myFeature6.setPropertyValue("geom1", GF.createPolygon(ring, null));
    myFeature6.setPropertyValue("geom2", GF.createPolygon(ring2, null));
    featureList.add(myFeature6);
    return featureList;
}
Also used : MultiPoint(org.locationtech.jts.geom.MultiPoint) FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) Coordinate(org.locationtech.jts.geom.Coordinate) LineString(org.locationtech.jts.geom.LineString) LinearRing(org.locationtech.jts.geom.LinearRing) Feature(org.opengis.feature.Feature)

Aggregations

FeatureCollection (org.geotoolkit.storage.feature.FeatureCollection)131 Feature (org.opengis.feature.Feature)75 Test (org.junit.Test)49 Coordinate (org.locationtech.jts.geom.Coordinate)49 LinearRing (org.locationtech.jts.geom.LinearRing)39 Query (org.geotoolkit.storage.feature.query.Query)31 FeatureType (org.opengis.feature.FeatureType)27 FeatureIterator (org.geotoolkit.storage.feature.FeatureIterator)24 LineString (org.locationtech.jts.geom.LineString)23 MultiPoint (org.locationtech.jts.geom.MultiPoint)16 ProcessDescriptor (org.geotoolkit.process.ProcessDescriptor)15 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)15 Geometry (org.locationtech.jts.geom.Geometry)14 AbstractProcessTest (org.geotoolkit.processing.vector.AbstractProcessTest)13 Session (org.geotoolkit.storage.feature.session.Session)12 CheckCloseFeatureIterator (org.geotoolkit.storage.feature.CheckCloseFeatureIterator)10 Point (org.locationtech.jts.geom.Point)10 GenericName (org.opengis.util.GenericName)10 NoSuchElementException (java.util.NoSuchElementException)8 File (java.io.File)7