use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildResultInter2.
private static FeatureSet buildResultInter2() throws FactoryException {
type = createSimpleTypeResult();
final FeatureCollection featureList = FeatureStoreUtilities.collection("SJ_Type1_SJ_Type2", 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(40, 30), new Coordinate(40, 50), new Coordinate(70, 50), new Coordinate(70, 30), new Coordinate(40, 30) });
feature1.setPropertyValue("geom1", geometryFactory.createPolygon(ring, null));
feature1.setPropertyValue("type", null);
feature1.setPropertyValue("age_SJ_Type2", null);
featureList.add(feature1);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildResultInter.
private static FeatureSet buildResultInter() throws FactoryException {
type = createSimpleTypeResult();
final FeatureCollection featureList = FeatureStoreUtilities.collection("SJ_Type1_SJ_Type2", type);
final Feature feature1 = type.newInstance();
feature1.setPropertyValue(AttributeConvention.IDENTIFIER, "id-01_id-12");
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));
feature1.setPropertyValue("type", "something2");
feature1.setPropertyValue("age_SJ_Type2", 2);
featureList.add(feature1);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class SpatialJoinTest method buildFeatureList2.
private static FeatureSet buildFeatureList2() 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", "Tree1");
feature1.setPropertyValue("age", 220);
feature1.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(2, 1)));
featureList.add(feature1);
final Feature feature2 = type.newInstance();
feature2.setPropertyValue(AttributeConvention.IDENTIFIER, "id-12");
feature2.setPropertyValue("type", "Tree2");
feature2.setPropertyValue("age", 100);
feature2.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(3, 6)));
featureList.add(feature2);
final Feature feature3 = type.newInstance();
feature3.setPropertyValue(AttributeConvention.IDENTIFIER, "id-13");
feature3.setPropertyValue("type", "Tree3");
feature3.setPropertyValue("age", 5);
feature3.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(5, 5)));
featureList.add(feature3);
final Feature feature4 = type.newInstance();
feature4.setPropertyValue(AttributeConvention.IDENTIFIER, "id-14");
feature4.setPropertyValue("type", "Tree4");
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-15");
feature5.setPropertyValue("type", "Tree5");
feature5.setPropertyValue("age", 57);
feature5.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(9, 5)));
featureList.add(feature5);
final Feature feature6 = type.newInstance();
feature6.setPropertyValue(AttributeConvention.IDENTIFIER, "id-16");
feature6.setPropertyValue("type", "Tree6");
feature6.setPropertyValue("age", 68);
feature6.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(9, 3)));
featureList.add(feature6);
final Feature feature7 = type.newInstance();
feature7.setPropertyValue(AttributeConvention.IDENTIFIER, "id-17");
feature7.setPropertyValue("type", "Tree7");
feature7.setPropertyValue("age", 94);
feature7.setPropertyValue("geom1", geometryFactory.createPoint(new Coordinate(11, 2)));
featureList.add(feature7);
return featureList;
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class AffineTransformTest method testAffineTransform.
@Test
public void testAffineTransform() throws ProcessException, NoSuchIdentifierException, FactoryException {
// Inputs
final FeatureCollection featureList = buildFeatureList();
final AffineTransform transform = new AffineTransform();
transform.setToTranslation(100, 100);
// Process
final ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:affinetransform");
final ParameterValueGroup in = desc.getInputDescriptor().createValue();
in.parameter("feature_in").setValue(featureList);
in.parameter("transform_in").setValue(transform);
final 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 = buildResultList();
compare(featureListResult, featureListOut);
}
use of org.geotoolkit.storage.feature.FeatureCollection in project geotoolkit by Geomatys.
the class ClipTest method testClip.
@Test
public void testClip() throws ProcessException, NoSuchIdentifierException, FactoryException {
// Inputs
final FeatureCollection featureList = buildFeatureList();
final FeatureCollection featuresClip = buildFeatureClip();
// Process
ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:clip");
ParameterValueGroup in = desc.getInputDescriptor().createValue();
in.parameter("feature_in").setValue(featureList);
in.parameter("feature_clip").setValue(featuresClip);
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 = buildResultList();
compare(featureListResult, featureListOut);
}
Aggregations