use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class RegroupTest method testRegroupGeometrySelected.
@Test
public void testRegroupGeometrySelected() throws ProcessException, NoSuchIdentifierException, FactoryException {
// Inputs
final FeatureCollection featureList = buildFeatureList();
// Process
ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:regroup");
ParameterValueGroup in = desc.getInputDescriptor().createValue();
in.parameter("feature_in").setValue(featureList);
in.parameter("regroup_attribute").setValue("type");
in.parameter("geometry_name").setValue("geom2");
org.geotoolkit.process.Process proc = desc.createProcess(in);
// Features out
final FeatureCollection featureListOut = (FeatureCollection) proc.call().parameter("feature_out").getValue();
// Expected Features out
final FeatureCollection featureListResult = buildResultList2();
compare(featureListResult, featureListOut);
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class RegroupTest method buildResultList2.
private static FeatureCollection buildResultList2() throws FactoryException {
type = createSimpleResultType2();
final FeatureCollection featureList = FeatureStoreUtilities.collection("noname", type);
Feature myFeature1 = type.newInstance();
Point pt1 = GF.createPoint(new Coordinate(3, 6));
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) });
LineString line1 = GF.createLineString(new Coordinate[] { new Coordinate(8.0, 0.0), new Coordinate(5.0, 3.0) });
LineString line3 = GF.createLineString(new Coordinate[] { new Coordinate(7.0, 0.0), new Coordinate(9.0, 3.0) });
GeometryCollection collec = GF.createGeometryCollection(new Geometry[] { line1, multPt, line3 });
myFeature1.setPropertyValue(AttributeConvention.IDENTIFIER, "type-office");
myFeature1.setPropertyValue("type", "office");
myFeature1.setPropertyValue("geom2", collec);
featureList.add(myFeature1);
Feature myFeature2 = type.newInstance();
pt1 = GF.createPoint(new Coordinate(3.5, 3.5));
LinearRing ring = 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) });
Polygon poly = GF.createPolygon(ring, null);
myFeature2.setPropertyValue(AttributeConvention.IDENTIFIER, "type-church");
myFeature2.setPropertyValue("type", "church");
myFeature2.setPropertyValue("geom2", GF.createGeometryCollection(new Geometry[] { poly, pt1 }));
featureList.add(myFeature2);
Feature myFeature3 = type.newInstance();
myFeature3.setPropertyValue(AttributeConvention.IDENTIFIER, "type-post office");
myFeature3.setPropertyValue("type", "post office");
myFeature3.setPropertyValue("geom2", GF.createPoint(new Coordinate(10, 5)));
featureList.add(myFeature3);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildFeatureListInter1.
private static FeatureSet buildFeatureListInter1() throws FactoryException {
type = createSimpleType1();
final FeatureCollection featureList = FeatureStoreUtilities.collection("target", type);
final Feature feature1 = type.newInstance();
feature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-01");
feature1.setPropertyValue("name", "Field");
feature1.setPropertyValue("age", 1);
LinearRing ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(4, 3), new Coordinate(4, 5), new Coordinate(7, 5), new Coordinate(7, 3), new Coordinate(4, 3) });
feature1.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
featureList.add(feature1);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildFeatureListInter2.
private static FeatureSet buildFeatureListInter2() throws FactoryException {
type = createSimpleType2();
final FeatureCollection featureList = FeatureStoreUtilities.collection("source", type);
final Feature feature1 = type.newInstance();
feature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-11");
feature1.setPropertyValue("type", "something1");
feature1.setPropertyValue("age", 1);
LinearRing ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(1, 3), new Coordinate(1, 5), new Coordinate(2, 5), new Coordinate(2, 3), new Coordinate(1, 3) });
feature1.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
featureList.add(feature1);
final Feature feature2 = type.newInstance();
feature2.setPropertyValue(AttributeConvention.IDENTIFIER, "id-12");
feature2.setPropertyValue("type", "something2");
feature2.setPropertyValue("age", 2);
ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(3, 2), new Coordinate(3, 6), new Coordinate(5, 6), new Coordinate(5, 2), new Coordinate(3, 2) });
feature2.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
featureList.add(feature2);
final Feature feature3 = type.newInstance();
feature3.setPropertyValue(AttributeConvention.IDENTIFIER, "id-13");
feature3.setPropertyValue("type", "something3");
feature3.setPropertyValue("age", 3);
ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(6, 4), new Coordinate(6, 6), new Coordinate(8, 6), new Coordinate(8, 4), new Coordinate(6, 4) });
feature3.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
featureList.add(feature3);
final Feature feature4 = type.newInstance();
feature4.setPropertyValue(AttributeConvention.IDENTIFIER, "id-14");
feature4.setPropertyValue("type", "something4");
feature4.setPropertyValue("age", 4);
ring = geometryFactory.createLinearRing(new Coordinate[] { new Coordinate(7, 2), new Coordinate(7, 3), new Coordinate(8, 3), new Coordinate(8, 2), new Coordinate(7, 2) });
feature4.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
featureList.add(feature4);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildFeatureList1.
private static FeatureSet buildFeatureList1() throws FactoryException {
type = createSimpleType1();
final FeatureCollection featureList = FeatureStoreUtilities.collection("Target", type);
final Feature feature1 = type.newInstance();
feature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-1");
feature1.setPropertyValue("name", "Human1");
feature1.setPropertyValue("age", 20);
feature1.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(3, 2)));
featureList.add(feature1);
final Feature feature2 = type.newInstance();
feature2.setPropertyValue(AttributeConvention.IDENTIFIER, "id-2");
feature2.setPropertyValue("name", "Human2");
feature2.setPropertyValue("age", 10);
feature2.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(3, 5)));
featureList.add(feature2);
final Feature feature3 = type.newInstance();
feature3.setPropertyValue(AttributeConvention.IDENTIFIER, "id-3");
feature3.setPropertyValue("name", "Human3");
feature3.setPropertyValue("age", 35);
feature3.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(6, 6)));
featureList.add(feature3);
final Feature feature4 = type.newInstance();
feature4.setPropertyValue(AttributeConvention.IDENTIFIER, "id-4");
feature4.setPropertyValue("name", "Human4");
feature4.setPropertyValue("age", 40);
feature4.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(6, 2)));
featureList.add(feature4);
final Feature feature5 = type.newInstance();
feature5.setPropertyValue(AttributeConvention.IDENTIFIER, "id-5");
feature5.setPropertyValue("name", "Human5");
feature5.setPropertyValue("age", 23);
feature5.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(7, 4)));
featureList.add(feature5);
final Feature feature6 = type.newInstance();
feature6.setPropertyValue(AttributeConvention.IDENTIFIER, "id-6");
feature6.setPropertyValue("name", "Human6");
feature6.setPropertyValue("age", 32);
feature6.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(9, 4)));
featureList.add(feature6);
final Feature feature7 = type.newInstance();
feature7.setPropertyValue(AttributeConvention.IDENTIFIER, "id-7");
feature7.setPropertyValue("name", "Human7");
feature7.setPropertyValue("age", 28);
feature7.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(9, 1)));
featureList.add(feature7);
return featureList;
}
Aggregations