Package org.geotools.feature

Examples of org.geotools.feature.FeatureCollection.features()


    private void fillCache(Query query) throws IOException {
        Query cloned = new DefaultQuery(query);
        cloned.getHints().remove(Hints.GEOMETRY_DISTANCE);
       
        FeatureCollection features = wrapped.getFeatures(cloned);
        FeatureIterator fi = features.features();
        index = null;
        STRtree newIndex = new STRtree();
        while (fi.hasNext()) {
            // consider turning all geometries into packed ones, to save space
            Feature f = fi.next();
View Full Code Here


        LRSSegmentProcess process = new LRSSegmentProcess();
        SimpleFeatureCollection origional = source.getFeatures();

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", 0.5, 1.5);
        Assert.assertEquals(1, result.size());
        Feature feature = result.features().next();
        MultiLineString segment = (MultiLineString) feature.getDefaultGeometryProperty().getValue();
        Assert.assertEquals(2, segment.getNumPoints());
        Assert.assertEquals(0.5, segment.getCoordinates()[0].x, 0.0);
        Assert.assertEquals(0.0, segment.getCoordinates()[0].y, 0.0);
        Assert.assertEquals(1.5, segment.getCoordinates()[1].x, 0.0);
View Full Code Here

        LRSSegmentProcess process = new LRSSegmentProcess();
        SimpleFeatureCollection origional = source.getFeatures();

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", 0.5, 3.5);
        Assert.assertEquals(1, result.size());
        Feature feature = result.features().next();
        MultiLineString segment = (MultiLineString) feature.getDefaultGeometryProperty().getValue();
        Assert.assertEquals(3, segment.getNumPoints());
        Assert.assertEquals(0.5, segment.getCoordinates()[0].x, 0.0);
        Assert.assertEquals(0.0, segment.getCoordinates()[0].y, 0.0);
        Assert.assertEquals(3.5, segment.getCoordinates()[2].x, 0.0);
View Full Code Here

        LRSSegmentProcess process = new LRSSegmentProcess();
        SimpleFeatureCollection origional = source.getFeatures();

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", 0.5, 5.5);
        Assert.assertEquals(1, result.size());
        Feature feature = result.features().next();
        MultiLineString segment = (MultiLineString) feature.getDefaultGeometryProperty().getValue();
        Assert.assertEquals(4, segment.getNumPoints());
        Assert.assertEquals(0.5, segment.getCoordinates()[0].x, 0.0);
        Assert.assertEquals(0.0, segment.getCoordinates()[0].y, 0.0);
        Assert.assertEquals(5.5, segment.getCoordinates()[3].x, 0.0);
View Full Code Here

        LRSGeocodeProcess process = new LRSGeocodeProcess();
        SimpleFeatureCollection origional = source.getFeatures();

        FeatureCollection result = process.execute(origional, "from_lrs", "to_lrs", 1.0);
        Assert.assertEquals(1, result.size());
        Feature feature = result.features().next();
        Point point = (Point) feature.getDefaultGeometryProperty().getValue();
        Assert.assertEquals(1.0, point.getX(), 0.0);
        Assert.assertEquals(0.0, point.getY(), 0.0);
    }
View Full Code Here

        GMLConfiguration gml = new GMLConfiguration();
        Parser parser = new Parser(gml);
        parser.setStrict(false);
       
        FeatureCollection features = (FeatureCollection) parser.parse(in);
        FeatureIterator i = features.features();
       
        int nfeatures = 0;
        while( i.hasNext() ) {
            SimpleFeature f = (SimpleFeature) i.next();
            System.out.println(f.getID());
View Full Code Here

        GMLConfiguration gml = new GMLConfiguration();
        Parser parser = new Parser(gml);
        parser.setStrict(false);
       
        FeatureCollection features = (FeatureCollection) parser.parse(in);
        FeatureIterator i = features.features();
       
        int nfeatures = 0;
        while( i.hasNext() ) {
            SimpleFeature f = (SimpleFeature) i.next();
            System.out.println(f.getID());
View Full Code Here

    public <T> T[] toArray(T[] arg0) {
        List<T> list = new ArrayList<T>();
        Iterator it = collections.iterator();
        while(it.hasNext()){
            FeatureCollection col = (FeatureCollection)it.next();
            FeatureIterator it2 = col.features();
            try {
                while (it2.hasNext()){
                    list.add((T)it.next());
                }
            }
View Full Code Here

        //create the result feature collection
        SimpleFeatureType targetSchema = getTargetSchema((SimpleFeatureType) features.getSchema(), input);
        DefaultFeatureCollection result = new DefaultFeatureCollection(null, targetSchema);

        SimpleFeatureBuilder fb = new SimpleFeatureBuilder((SimpleFeatureType) result.getSchema());
        FeatureIterator fi = features.features();
        try {
            int counter = 0;
            while( fi.hasNext() ) {
                //copy the feature
                fb.init((SimpleFeature) fi.next());
View Full Code Here

                new Coordinate(0.0, 51.5) });
        DWithin filter = ff.dwithin(ff.property(aname("geo")), ff.literal(line), 130000d, "metre");
        FeatureCollection features = dataStore.getFeatureSource(tname("geopoint")).getFeatures(
                filter);
        assertEquals(1, features.size());
        FeatureIterator fi = features.features();
        assertTrue(fi.hasNext());
        SimpleFeature feature = (SimpleFeature) fi.next();
        assertEquals("Reykjavik", feature.getAttribute("name"));
        fi.close();
    }
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.