Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureCollection


        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setFeatureTypeConversionFunction(function).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, simplifiedPoints));

        // check for exceptions when using a function that returns features with a wrong featuretype
        try {
            String wrongFeaturesName = "wrongFeatures";
View Full Code Here


        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .exportDefaultFeatureType().call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), expectedPoints.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, expectedPoints));
    }
View Full Code Here

        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setAlter(true).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, points));
    }
View Full Code Here

        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setAlter(true)
                .setFilterFeatureTypeId(RevFeatureTypeImpl.build(modifiedPointsType).getId()).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(featureCollection.size(), points.length);
        SimpleFeatureIterator features = featureCollection.features();
        while (features.hasNext()) {
            List<Object> attributes = features.next().getAttributes();
            assertEquals(4, attributes.size());
        }
View Full Code Here

        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        geogig.command(ExportOp.class).setFeatureStore(featureStore).setPath(pointsName)
                .setFilterFeatureTypeId(RevFeatureTypeImpl.build(modifiedPointsType).getId()).call();
        featureSource = dataStore.getFeatureSource(typeName);
        featureStore = (SimpleFeatureStore) featureSource;
        SimpleFeatureCollection featureCollection = featureStore.getFeatures();
        assertEquals(expectedPoints.length, featureCollection.size());
        SimpleFeatureIterator features = featureCollection.features();
        assertTrue(collectionsAreEqual(features, expectedPoints));
    }
View Full Code Here

    private void testDiffFeatures(ObjectId oldRoot, ObjectId newRoot, int expectedAdded,
            int expectedRemoved, int expectedChanged) throws IOException {

        dataStore.setHead(newRoot.toString());
        List<String> fids;
        SimpleFeatureCollection features;

        ChangeType changeType = ChangeType.ADDED;
        features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType)
                .getFeatures();
        fids = toIdList(features);
        assertEquals(changeType + fids.toString(), expectedAdded, fids.size());
        assertEquals(changeType + fids.toString(), expectedAdded, features.size());

        changeType = ChangeType.REMOVED;
        features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType)
                .getFeatures();
        fids = toIdList(features);
        assertEquals(changeType + fids.toString(), expectedRemoved, fids.size());
        assertEquals(changeType + fids.toString(), expectedRemoved, features.size());

        changeType = ChangeType.CHANGED_NEW;
        features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType)
                .getFeatures();
        fids = toIdList(features);
        assertEquals(changeType + fids.toString(), expectedChanged, fids.size());
        assertEquals(changeType + fids.toString(), expectedChanged, features.size());

        changeType = ChangeType.CHANGED_OLD;
        features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType)
                .getFeatures();
        fids = toIdList(features);
        assertEquals(changeType + fids.toString(), expectedChanged, fids.size());
        assertEquals(changeType + fids.toString(), expectedChanged, features.size());
    }
View Full Code Here

        private void doRead() throws IOException {
            final String typeName = pointType.getTypeName();
            SimpleFeatureSource featureSource;
            featureSource = dataStore.getFeatureSource(typeName);
            SimpleFeatureCollection fc = featureSource.getFeatures();
            SimpleFeatureIterator features = fc.features();
            while (features.hasNext()) {
                SimpleFeature next = features.next();
            }
            features.close();
        }
View Full Code Here

        assertEquals(2, linesSource.getCount(new Query(linesName, filter)));
    }

    @Test
    public void testGetFeatures() throws Exception {
        SimpleFeatureCollection collection;
        Set<List<Object>> actual;
        Set<List<Object>> expected;

        collection = pointsSource.getFeatures();
        assertEquals(pointsType, collection.getSchema());

        actual = Sets.newHashSet();
        for (Feature f : toList(collection)) {
            SimpleFeature sf = (SimpleFeature) f;
            actual.add(sf.getAttributes());
        }

        expected = ImmutableSet.of(((SimpleFeature) points1).getAttributes(),
                ((SimpleFeature) points2).getAttributes(),
                ((SimpleFeature) points3).getAttributes());

        assertEquals(expected, actual);

        collection = linesSource.getFeatures();
        assertEquals(linesType, collection.getSchema());

        actual = Sets.newHashSet();
        for (Feature f : toList(collection)) {
            actual.add(((SimpleFeature) f).getAttributes());
        }
View Full Code Here

        assertEquals(expected, actual);
    }

    @Test
    public void testGetFeaturesFilter() throws Exception {
        SimpleFeatureCollection collection;
        Set<List<Object>> actual;
        Set<List<Object>> expected;

        Filter filter;
View Full Code Here

    }

    @Test
    public void testFeatureIdsAreVersioned() throws IOException {
        SimpleFeatureCollection collection = pointsSource.getFeatures(Query.ALL);
        SimpleFeatureIterator features = collection.features();

        Set<FeatureId> ids = Sets.newHashSet();
        try {
            while (features.hasNext()) {
                SimpleFeature next = features.next();
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.