Examples of MemoryFeatureCollection


Examples of org.geotools.data.memory.MemoryFeatureCollection

        }
        geoms[i] = gf.createLineString(c);
      }
     
      SimpleFeature features[] = new SimpleFeature[geoms.length];
      MemoryFeatureCollection mm = new MemoryFeatureCollection(featureType);
      for (int i = 0; i < geoms.length; i ++){
        features[i] = fb.buildFeature(i +"", new Object[]{new Integer(i), geoms[i]});
        mm.add(features[i]);
      }
     
      DataStore ds = new MemoryDataStore(mm);
      FeatureCache cache = new GridFeatureCache(ds.getFeatureSource(featureType.getTypeName()), 4, 4, MemoryStorage.createInstance());
     
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

      geoms[i] = gf.createLineString(c);
    }

    SimpleFeature features[] = new SimpleFeature[geoms.length];

    MemoryFeatureCollection mm = new MemoryFeatureCollection(featureType);
    for (int i = 0; i < geoms.length; i++) {
      features[i] = fb.buildFeature(i + "", new Object[] {
          new Integer(i), geoms[i] });
      mm.add(features[i]);
    }

    //
    // ---- CACHING FEATURE COLLECTION -----
    //
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

        }
        geoms[i] = gf.createLineString(c);
      }
     
      SimpleFeature features[] = new SimpleFeature[geoms.length];
      MemoryFeatureCollection mm = new MemoryFeatureCollection(featureType);
      for (int i = 0; i < geoms.length; i ++){
        features[i] = fb.buildFeature(i +"", new Object[]{new Integer(i), geoms[i]});
        mm.add(features[i]);
      }
     
      DataStore ds = new MemoryDataStore(mm);
      FeatureCache cache = new StreamingGridFeatureCache(ds.getFeatureSource(featureType.getTypeName()), 4, 4, MemoryStorage.createInstance());
     
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

                assertEquals(type1.getDescriptor(i).getName(), type2.getDescriptor(i).getName());
                assertEquals(type1.getDescriptor(i).getType(), type2.getDescriptor(i).getType());
            }
           
            //compare data
            MemoryFeatureCollection memCollection = new MemoryFeatureCollection(type2);
            while (reader.hasNext()) {
                memCollection.add(reader.next());
            }
           
            assertEquals(sCollection.size(), memCollection.size());
           
            SimpleFeatureIterator it = sCollection.features();
            while (it.hasNext()) {
                SimpleFeature sf = it.next();
                for (int i = 0; i < type1.getDescriptors().size(); i++) {
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    protected void addFeature(int id, Date time, Double elevation, Date referenceTime, Double scanningAngle) throws IOException {
        FeatureTypeInfo timeElevationCustom = getCatalog().getFeatureTypeByName(
                TIME_ELEVATION_CUSTOM.getLocalPart());
        FeatureStore fs = (FeatureStore) timeElevationCustom.getFeatureSource(null, null);
        SimpleFeatureType type = (SimpleFeatureType)timeElevationCustom.getFeatureType();
        MemoryFeatureCollection coll = new MemoryFeatureCollection(type);
        StringBuffer content = new StringBuffer();
        content.append(id);
        content.append('|');
        content.append(time.toString());
        content.append('|');
        content.append(elevation);
        content.append('|');
        content.append(referenceTime.toString());
        content.append('|');
        content.append(scanningAngle);
       
        SimpleFeature f = DataUtilities.createFeature(type, content.toString());
        coll.add(f);
        org.geotools.data.Transaction tx = fs.getTransaction();
        fs.addFeatures(coll);
        tx.commit();
    }
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    protected void addFeature(int id, Date time, Double elevation) throws IOException {
        FeatureTypeInfo timeWithStartEnd = getCatalog().getFeatureTypeByName(
                ELEVATION_WITH_START_END.getLocalPart());
        FeatureStore fs = (FeatureStore) timeWithStartEnd.getFeatureSource(null, null);
        SimpleFeatureType type = (SimpleFeatureType) timeWithStartEnd.getFeatureType();
        MemoryFeatureCollection coll = new MemoryFeatureCollection(type);
        StringBuffer content = new StringBuffer();
        content.append(id);
        content.append('|');
        content.append(time.toString());
        content.append("||");
        content.append(elevation);
        content.append('|');
       
        SimpleFeature f = DataUtilities.createFeature(type, content.toString());
        coll.add(f);
        org.geotools.data.Transaction tx = fs.getTransaction();
        fs.addFeatures(coll);
        tx.commit();
    }
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    protected void addFeature(int id, Date time, Double elevation) throws IOException {
        FeatureTypeInfo timeWithStartEnd = getCatalog().getFeatureTypeByName(
                TIME_WITH_START_END.getLocalPart());
        FeatureStore fs = (FeatureStore) timeWithStartEnd.getFeatureSource(null, null);
        SimpleFeatureType type = (SimpleFeatureType) timeWithStartEnd.getFeatureType();
        MemoryFeatureCollection coll = new MemoryFeatureCollection(type);
        StringBuffer content = new StringBuffer();
        content.append(id);
        content.append('|');
        content.append(time.toString());
        content.append("||");
        content.append(elevation);
        content.append('|');
       
        SimpleFeature f = DataUtilities.createFeature(type, content.toString());
        coll.add(f);
        org.geotools.data.Transaction tx = fs.getTransaction();
        fs.addFeatures(coll);
        tx.commit();
    }
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    private void addPointToMap(Point point) {
        //the type, schema = ( name:String, classification:Integer, height:Double, location:Point)
        SimpleFeatureType type = createPointFeatureType();

        MemoryFeatureCollection memoryFeatureCollection = new MemoryFeatureCollection(type);

        //create the builder
        SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);

        //add the values
        builder.add(point);
        //builder.add("City");

        //build the feature with provided ID
        SimpleFeature feature = builder.buildFeature(null);

        memoryFeatureCollection.add(feature);
        Style style = SLD.createPointStyle("Circle", Color.RED, Color.GREEN, 1, 10);

        Layer layer = new FeatureLayer(memoryFeatureCollection, style);
        map.addLayer(layer);
    }
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.