Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureCollection.features()


        assertTrue(expectedBounds.boundsEquals2D(grid.getBounds(), TOL));

        boolean[] flag = new boolean[expectedNumElements + 1];
        int count = 0;

        SimpleFeatureIterator iter = grid.features();
        try {
            while (iter.hasNext()) {
                SimpleFeature f = iter.next();
                int id = (Integer) f.getAttribute("id");
                assertFalse(id == 0);
View Full Code Here


            //add the features
            //we are using an array because
            //making a memory data store from a feature collection results
            //in a null pointer exception
            ArrayList<SimpleFeature> features = new ArrayList<SimpleFeature>();
            SimpleFeatureIterator it = fc.features();
            try{
                for( ; it.hasNext(); ) {
                    SimpleFeature type = (SimpleFeature) it.next();
                    features.add(type);
                }
View Full Code Here

        assertEquals(expectedNumElements, grid.size());

        boolean[] flag = new boolean[expectedNumElements + 1];
        int count = 0;

        SimpleFeatureIterator iter = grid.features();
        try {
            while (iter.hasNext()) {
                SimpleFeature f = iter.next();
                int id = (Integer) f.getAttribute("id");
                assertFalse(id == 0);
View Full Code Here

       
        // check size
        assertEquals(1, features.size());
       
        // check actual iteration
        SimpleFeatureIterator it = features.features();
        int count = 0;
        try {
            assertTrue(it.hasNext());
            it.next();
            count++;
View Full Code Here

        } catch (IOException ex) {
            ex.printStackTrace();
            Assert.fail();
        }

        SimpleFeatureIterator it = fCollection.features();
        try {
            SimpleFeature feature1 = it.next();
           
            SimpleFeature feature2 = it.next();
            // SimpleFeature feature3 = it.next();
View Full Code Here

        } catch (IOException ex) {
            ex.printStackTrace();
            Assert.fail();
        }

        SimpleFeatureIterator it = fCollection.features();
        try {
            SimpleFeature feature1 = it.next();
   
            assertTrue(feature1 instanceof PreGeneralizedSimpleFeature);
   
View Full Code Here

                idFilter, new String[] { testColumn });
        final SimpleFeatureCollection indexedfeatures = indexedstore.getFeatureSource()
                .getFeatures(query);

        // compare the results
        SimpleFeatureIterator indexIterator = indexedfeatures.features();
        SimpleFeature indexedFeature = indexIterator.next();
        indexIterator.close();

        // get the value of the duplicate column & compare it against expectation
        assertEquals(expectedValue, indexedFeature.getAttribute(testColumn));
View Full Code Here

        SimpleFeatureSource fs = shapeDS.getFeatureSource(typeName);
        SimpleFeatureType ftype = fs.getSchema();
        DataStore[] dataStores = createDataStores(shapeFile, targetDir, ftype, distanceArray);

        SimpleFeatureCollection fcoll = fs.getFeatures();
        SimpleFeatureIterator it = fcoll.features();
        try {
            int countTotal = fcoll.size();
   
            List<FeatureWriter<SimpleFeatureType, SimpleFeature>> writers = new ArrayList<FeatureWriter<SimpleFeatureType, SimpleFeature>>();
            for (int i = 0; i < dataStores.length; i++) {
View Full Code Here

    }

    public void testGetFeatureSource() throws Exception {
        SimpleFeatureSource road = store.getFeatureSource("road");
        SimpleFeatureCollection features = road.getFeatures();
        SimpleFeatureIterator reader = features.features();
        List<String> list = new ArrayList<String>();
        try {
            while (reader.hasNext()) {
                list.add(reader.next().getID());
            }
View Full Code Here

        query.setHints( hints );
       
        SimpleFeatureCollection features =
            getFeatureSource( featureTypeName ).getFeatures( query )
        if ( !features.isEmpty() ) {
            SimpleFeatureIterator fi = features.features();
            try {
                if ( fi.hasNext() ) {
                    return fi.next();
                }
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.