Search in sources :

Example 1 with SimpleFeatureImpl

use of org.geotools.feature.simple.SimpleFeatureImpl in project polymap4-core by Polymap4.

the class RFeatureStoreTests method testCreateSimpleSchemaAndFeatureWithoutId.

public void testCreateSimpleSchemaAndFeatureWithoutId() throws Exception {
    log.debug("creating schema...");
    SimpleFeatureType schema = createSimpleSchema();
    ds.createSchema(schema);
    RFeatureStore fs = (RFeatureStore) ds.getFeatureSource(schema.getName());
    assertEquals(0, Iterables.size(iterable(fs.getFeatures())));
    // add feature
    // SimpleFeatureBuilder always creates a default id
    DefaultFeatureCollection features = new DefaultFeatureCollection();
    features.add(new SimpleFeatureImpl(Lists.newArrayList("value", null), schema, null));
    fs.addFeatures(features);
    // check size
    assertEquals(1, Iterables.size(iterable(fs.getFeatures())));
}
Also used : SimpleFeatureImpl(org.geotools.feature.simple.SimpleFeatureImpl) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) DefaultFeatureCollection(org.geotools.feature.DefaultFeatureCollection)

Aggregations

DefaultFeatureCollection (org.geotools.feature.DefaultFeatureCollection)1 SimpleFeatureImpl (org.geotools.feature.simple.SimpleFeatureImpl)1 SimpleFeatureType (org.opengis.feature.simple.SimpleFeatureType)1