Package org.geotools.data.collection

Examples of org.geotools.data.collection.ListFeatureCollection


        if (boundsCRS != null && builderCRS != null &&
                !CRS.equalsIgnoreMetadata(boundsCRS, builderCRS)) {
            throw new IllegalArgumentException("Different CRS set for bounds and the feature builder");
        }

        final ListFeatureCollection fc = new ListFeatureCollection(gridFeatureBuilder.getType());
        OblongBuilder gridBuilder = new OblongBuilder(bounds, width, height);
        gridBuilder.buildGrid(gridFeatureBuilder, vertexSpacing, fc);
        return DataUtilities.source(fc);
    }
View Full Code Here


        // wrap as a feature collection and return
        final SimpleFeatureType featureType = CoverageUtilities.createFeatureType(coverage, Polygon.class);
        final SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
        int i = 0;
        final ListFeatureCollection featureCollection = new ListFeatureCollection(featureType);
        final AffineTransformation jtsTransformation = new AffineTransformation(
                mt2D.getScaleX(),
                mt2D.getShearX(),
                mt2D.getTranslateX(),
                mt2D.getShearY(),
                mt2D.getScaleY(),
                mt2D.getTranslateY());
        for (Polygon polygon : prop) {
            // get value
            Double value = (Double) polygon.getUserData();
            polygon.setUserData(null);
            // filter coordinates in place
            polygon.apply(jtsTransformation);

            // create feature and add to list
            builder.set("the_geom", polygon);
            builder.set("value", value);

            featureCollection.add(builder.buildFeature(String.valueOf(i++)));

        }

        //return value
        return featureCollection;
View Full Code Here

            /*
             * SimpleFeatureStore has a method to add features from a
             * SimpleFeatureCollection object, so we use the ListFeatureCollection
             * class to wrap our list of features.
             */
            SimpleFeatureCollection collection = new ListFeatureCollection(TYPE, features);
            featureStore.setTransaction(transaction);
            try {
                featureStore.addFeatures(collection);
                transaction.commit();
            } catch (Exception problem) {
View Full Code Here

        CoordinateReferenceSystem crs = null;
    tb.add("geom", Geometry.class, crs );
        tb.add("count", Integer.class);
        SimpleFeatureType schema = tb.buildFeatureType();

        ListFeatureCollection fc = new ListFeatureCollection(schema);
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(schema);

        GeometryFactory factory = new GeometryFactory(new PackedCoordinateSequenceFactory());

        Geometry point = factory.createPoint(new Coordinate(10, 10));
        fb.add(point);
        fb.add(5);
       
        fc.add(fb.buildFeature(null));

        return fc;
    }
View Full Code Here

        // wrap as a feature collection and return
        final SimpleFeatureType schema = CoverageUtilities
                .createFeatureType(gc2d, LineString.class);
        final SimpleFeatureBuilder builder = new SimpleFeatureBuilder(schema);
        int i = 0;
        final ListFeatureCollection featureCollection = new ListFeatureCollection(schema);
        final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(),
                mt2D.getShearX(), mt2D.getTranslateX(), mt2D.getShearY(), mt2D.getScaleY(),
                mt2D.getTranslateY());
        for (LineString line : prop) {

            // get value
            Double value = (Double) line.getUserData();
            line.setUserData(null);
            // filter coordinates in place
            line.apply(jtsTransformation);

            // create feature and add to list
            builder.set("the_geom", line);
            builder.set("value", value);

            featureCollection.add(builder.buildFeature(String.valueOf(i++)));

        }

        // return value
View Full Code Here

        if (boundsCRS != null && builderCRS != null &&
                !CRS.equalsIgnoreMetadata(boundsCRS, builderCRS)) {
            throw new IllegalArgumentException("Different CRS set for bounds and the feature builder");
        }

        final ListFeatureCollection fc = new ListFeatureCollection(lineFeatureBuilder.getType());
        OrthoLineBuilder lineBuilder = new OrthoLineBuilder(bounds);
        lineBuilder.buildGrid(lineDefs, lineFeatureBuilder, vertexSpacing, fc);
        return DataUtilities.source(fc);
    }
View Full Code Here

        tb.setName("bufferedCollection");
        SimpleFeatureType schema = tb.buildFeatureType();
       
        // compute the output features
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(schema);
        ListFeatureCollection result = new ListFeatureCollection(schema);
        SimpleFeatureIterator fi = fc.features();
        while(fi.hasNext()) {
            SimpleFeature f = fi.next();
            fb.add(((Geometry) f.getDefaultGeometry()).buffer(distance));
            result.add(fb.buildFeature(null));
        }
       
        return result;
    }
View Full Code Here

        typeBuilder.setName("points");
        typeBuilder.add("wkt", String.class);
        typeBuilder.add("label", String.class);
        SimpleFeatureType TYPE = typeBuilder.buildFeatureType();

        ListFeatureCollection features = new ListFeatureCollection(TYPE);
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(TYPE);
        for (int i = 0; i < 10; i++) {
            fb.add("POINT(" + i + " " + i + ")");
            fb.add("this is " + i);
            features.add(fb.buildFeature(null));
        }

        // setup a point layer with the right geometry trnasformation
        Style style = SLD.createPointStyle("circle", Color.BLUE, Color.BLUE, 1f, 10f);
        PointSymbolizer ps = (PointSymbolizer) style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
View Full Code Here

            }, null);
        } catch(IOException e) {
            throw new RuntimeException("Failed to compute output collection", e);
        }
       
        return new ListFeatureCollection(targetSchema, features);
    }
View Full Code Here

        tb.add("geom", Polygon.class, "EPSG:4326");
        tb.add("name", String.class);
        tb.setName("circles");
        SimpleFeatureType ft = tb.buildFeatureType();
       
        fc = new ListFeatureCollection(ft);
       
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(ft);
        fb.add(reader.read("POINT(0 0)").buffer(10));
        fb.add("one");
        fc.add(fb.buildFeature(null));
View Full Code Here

TOP

Related Classes of org.geotools.data.collection.ListFeatureCollection

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.