Package org.geotools.data.collection

Examples of org.geotools.data.collection.ListFeatureCollection


        definitions.add(new Definition("geom", ECQL.toExpression("buffer(the_geom, 1)")));
        definitions.add(new Definition("name", ECQL.toExpression("strToLowercase(state_name)")));
        definitions.add(new Definition("total", ECQL.toExpression("male + female")));
        definitions.add(new Definition("logp", ECQL.toExpression("log(persons)")));
       
        ListFeatureCollection fc = new ListFeatureCollection(STATES.getSchema());
        SimpleFeatureSource emptySource = DataUtilities.source(fc);

        SimpleFeatureSource transformed = TransformFactory.transform(emptySource, "bstates", definitions);
        return transformed;
    }
View Full Code Here


            SimpleFeatureStore store = (SimpleFeatureStore) tileIndexStore
                    .getFeatureSource(typeName);
            store.setTransaction(transaction);

            ListFeatureCollection featureCollection = new ListFeatureCollection(
                    tileIndexStore.getSchema(typeName));

            // add them all
            Set<FeatureId> fids = new HashSet<FeatureId>();
            for (SimpleFeature f : granules) {
                // Add the feature to the feature collection
                featureCollection.add(f);
                fids.add(ff.featureId(f.getID()));
            }
            store.addFeatures(featureCollection);

            // update bounds
View Full Code Here

       
        feature = builder.buildFeature("trip6", new Object[]{gf.createPoint( new Coordinate(0,0)), "How well can we encode 1\\2?", 5 });
        feature.getUserData().put( Hints.USE_PROVIDED_FID, true );
        list.add( feature );
       
        ListFeatureCollection features = new ListFeatureCollection(schema, list );
       
        unusalStore.createSchema( schema );
        SimpleFeatureStore trip = (SimpleFeatureStore) unusalStore.getFeatureSource("trip");
       
        trip.addFeatures( features );
View Full Code Here

        tbuilder.setName("points");
        tbuilder.add("geom", Point.class);
        tbuilder.add("NAME", String.class);
        SimpleFeatureType type = tbuilder.buildFeatureType();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
        ListFeatureCollection features = new ListFeatureCollection(type);
        for (int i = 0, ii = 20; i < ii; i++) {
            features.add(fb.buildFeature(null, new Object[] {
                    new GeometryFactory().createPoint(new Coordinate(1, -1)),
                    "Point" + String.valueOf(i)
            }));
        }
        return features;
View Full Code Here

        tbuilder.add("j", Long.class);
        tbuilder.add("k", BigDecimal.class);
        tbuilder.add("l", BigInteger.class);
        SimpleFeatureType type = tbuilder.buildFeatureType();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
        ListFeatureCollection features = new ListFeatureCollection(type);
        for (int i = 0, ii = 20; i < ii; i++) {
            features.add(fb.buildFeature(null, new Object[] {
                    new GeometryFactory().createPoint(new Coordinate(1, -1)), new Byte((byte) i),
                    new Short((short) i), new Double(i), new Float(i), new String(i + " "),
                    new Date(i), new Boolean(true), new Integer(22),
                    new Long(1234567890123456789L),
                    new BigDecimal(new BigInteger("12345678901234567890123456789"), 2),
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

        tb.add("value", features.getSchema().getDescriptor(attIndex).getType().getBinding());
        tb.setName("UniqueValue");
        SimpleFeatureType ft = tb.buildFeatureType();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(ft);

        ListFeatureCollection result = new ListFeatureCollection(ft);
        for (Object value : uniqueValues) {
            fb.add(value);
            result.add(fb.buildFeature(null));
        }
        return result;
    }
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

        } else {
            generator = new MetricGenerator(center, quadrantSegments, UnitConverter.IDENTITY);
        }

        // we don't expect million of directions, so we use a simple in memory collection
        SimpleFeatureCollection result = new ListFeatureCollection(schema);
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(schema);
        for (int i = 0; i < distances.length; i++) {
            fb.add(generator.getBuffer(distances[i]));
            fb.add(distances[i]);
            result.add(fb.buildFeature("buffers." + (i + 1)));
        }

        return result;
    }
View Full Code Here

    // prepare a mock feature collection
    SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
    tb.setName("test");
    final ReferencedEnvelope re = new ReferencedEnvelope(-10, 10, -10, 10,
        null);
    FeatureCollection fc = new ListFeatureCollection(tb.buildFeatureType()) {
      @Override
      public synchronized ReferencedEnvelope getBounds() {
        return re;
      }
    };
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.