Package org.geotools.feature

Examples of org.geotools.feature.FeatureCollection


    public void testNoElementsReturned() throws Exception {
        final Filter filter = ff.equals(ff.property("gml:name"), ff
                .literal("invalid name"));       

        FeatureCollection features = getFeatures(MAX_FEATURES, filter);
       
        assertEquals(0, DataUtilities.count(features));

        List<Feature> results = new ArrayList<Feature>();
        FeatureIterator it = features.features();
        for (; it.hasNext();) {
            results.add((Feature) it.next());
        }
        it.close();
        assertEquals(0, results.size());
View Full Code Here


        final Name GeologicUnitName = new NameImpl(FeatureChainingTest.GSMLNS, "GeologicUnit");
        final Name GeologicUnitType = new NameImpl(FeatureChainingTest.GSMLNS, "GeologicUnitType");

        List<Feature> results = new ArrayList<Feature>();

        FeatureCollection features = getFeatures(Query.DEFAULT_MAX, Filter.INCLUDE);
        FeatureIterator it = features.features();
        for (; it.hasNext();) {
            results.add((Feature) it.next());
        }
        it.close();
       
View Full Code Here

    }
   
    private FeatureCollection getFeatures(final int maxFeatures, Filter inputFilter)
            throws Exception {
        FeatureSource fSource = (FeatureSource) mappingDataStore.getFeatureSource(typeName);
        FeatureCollection features = (FeatureCollection) fSource.getFeatures(namedQuery(
                inputFilter, new Integer(maxFeatures)));
        return features;
    }
View Full Code Here

        buildDocument(resource);
       
        FeatureCollectionType fc = (FeatureCollectionType) parse();
        assertEquals( 1, fc.getFeature().size() );
       
        FeatureCollection features = (FeatureCollection) fc.getFeature().get( 0 );
        assertEquals( 2, features.size() );
       
        FeatureIterator fi = features.features();
        try {
            assertTrue( fi.hasNext() );
            SimpleFeature f = (SimpleFeature) fi.next();
           
            assertEquals( "feature", f.getType().getTypeName() );
View Full Code Here

        assertNotNull(mfDataAccess);

        FeatureSource guSource = (FeatureSource) guDataStore
                .getFeatureSource(FeatureChainingTest.GEOLOGIC_UNIT);

        FeatureCollection guFeatures = (FeatureCollection) guSource.getFeatures();
        assertEquals(3, size(guFeatures));

        FeatureSource cpSource = DataAccessRegistry
                .getFeatureSource(FeatureChainingTest.COMPOSITION_PART);
        FeatureCollection cpFeatures = (FeatureCollection) cpSource.getFeatures();
        assertEquals(4, size(cpFeatures));

        FeatureSource cgiSource = DataAccessRegistry
                .getFeatureSource(FeatureChainingTest.CGI_TERM_VALUE);
        FeatureCollection cgiFeatures = (FeatureCollection) cgiSource.getFeatures();
        assertEquals(6, size(cgiFeatures));
    }
View Full Code Here

        Hints hints = new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY,
                new LiteCoordinateSequenceFactory());
        q.setHints(hints);

        // check the srs you get is the expected one
        FeatureCollection fc = fs.getFeatures(q);
        FeatureType fcSchema = fc.getSchema();
        assertEquals(epsg4326, fcSchema.getCoordinateReferenceSystem());
        assertEquals(epsg4326, fcSchema.getGeometryDescriptor().getCoordinateReferenceSystem());

        // build up the reference 2d line, the 3d one is (1 1 0, 2 2 0, 4 2 1, 5
        // 1 1)
View Full Code Here

                                    iterator = Arrays.asList(array).iterator();
                                } else if (obj instanceof Collection) {
                                    Collection collection = (Collection) obj;
                                    iterator = collection.iterator();
                                } else if (obj instanceof FeatureCollection) {
                                    FeatureCollection collection = (FeatureCollection) obj;
                                    iterator = DataUtilities.iterator( collection.features() );
                                } else {
                                    iterator = new SingleIterator(obj);
                                }

                                entry.children.add(new Object[] { child, iterator, obj });
View Full Code Here

     *            a Style object to be used in rendering this layer
     */
    @SuppressWarnings("unchecked")
    public void addLayer(Collection collection, Style style) {
        if (collection instanceof FeatureCollection) {
            FeatureCollection featureCollection = (FeatureCollection) collection;
            addLayer( featureCollection, style);
        } else {
            throw new IllegalArgumentException("FeatureCollection required");
        }
    }
View Full Code Here

     * @param collection
     *            Collection with the new layer that will be added.
     */
    public void addLayer(Collection collection, Style style) {
        if (collection instanceof FeatureCollection) {
            FeatureCollection featureCollection = (FeatureCollection) collection;
            addLayer(featureCollection, style);
        } else {
            throw new IllegalArgumentException("FeatureCollection required");
        }
    }
View Full Code Here

        GMLConfiguration config = new GMLConfiguration();
        Parser p = new Parser( config );
        Object o = p.parse( new ByteArrayInputStream( out.toByteArray() ) );
        assertTrue( o instanceof FeatureCollection );
       
        FeatureCollection features = (FeatureCollection) o;
        assertEquals( 3, features.size() );
       
        FeatureIterator fi = features.features();
        try {
            for ( int i = 0; i < 3; i++ ) {
                assertTrue( fi.hasNext() );
               
                SimpleFeature f = (SimpleFeature) fi.next();
View Full Code Here

TOP

Related Classes of org.geotools.feature.FeatureCollection

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.