Package org.geotools.data.memory

Examples of org.geotools.data.memory.MemoryDataStore


        ftb.setName("test");
        ftb.add("val", valueClass);
        ftb.add("intVal", Integer.class);
        featureType = ftb.buildFeatureType();
        featureBuilder = new SimpleFeatureBuilder(featureType);
        dataStore = new MemoryDataStore(featureType);
    }
View Full Code Here


private void validationExample() throws Exception{
    SimpleFeatureCollection roadFeatures = null;
    SimpleFeatureCollection riverFeatures = null;

    // validationExample start
    MemoryDataStore store;
    store = new MemoryDataStore();
    store.addFeatures( roadFeatures );
    store.addFeatures( riverFeatures );
   
    //
    // SETUP
    //
    ValidationProcessor processor = new ValidationProcessor();
View Full Code Here

  private void save() throws Exception
  {
    FeatureStore fs = (FeatureStore) ds.getFeatureSource("poly_county");
    FeatureType ft = fs.getSchema();
   
    MemoryDataStore memorystore =new MemoryDataStore();
   
    ArrayList polys = new ArrayList(resultPolygon);
   
    Geometry gfinal = null;
    if (polys.size() == 1)
    {
      gfinal = (Polygon) polys.get(0);   //POLYGON
    }
    else
    {
      GeometryFactory gf = ((Polygon) polys.get(0)).getFactory();
      gfinal = new MultiPolygon((Polygon[]) polys.toArray( new Polygon[polys.size()]),   gf    );
    }
   
    gfinal = gfinal.buffer(0); // for topologic problems.
   
     
      Object[] values = new Object[5];
      values[ft.find("module")] = MODULE;
      values[ft.find("gen_full")] = gfinal;
     
      values[ft.find("gen_1")] = generalize(gfinal,tolerance1);;
      values[ft.find("gen_2")] = generalize(gfinal,tolerance1);;
      values[ft.find("gen_3")] = generalize(gfinal,tolerance1);;
     
      Feature f = ft.create(values);
      memorystore.addFeature(f);
   
    fs.addFeatures(memorystore.getFeatureReader("poly_county"));
   
  }
View Full Code Here

//               otherName text     ) with oids;
   
    FeatureStore fs = (FeatureStore) ds.getFeatureSource("major_roads");
    FeatureType ft = fs.getSchema();
   
    MemoryDataStore memorystore =new MemoryDataStore();
   
    System.out.println("saving interstate");
   
    addStuff(memorystore,interstate,"interstate",ft);
   
    System.out.println("saving ushighway");
   
    addStuff(memorystore,ushighway,"ushighway",ft);
   
    System.out.println("saving statehighway");
   
    addStuff(memorystore,statehighway,"statehighway",ft);
   
    System.out.println("saving othername");
   
    addStuff(memorystore,other,"othername",ft);
   
    System.out.println("writing to DB");
   
    fs.addFeatures(memorystore.getFeatureReader("major_roads"));
  }
View Full Code Here

        buildType.setName(typename);
        buildType.addAll(newTypes);
       
        final SimpleFeatureType schema = buildType.buildFeatureType();
        // Configure memory datastore
        final MemoryDataStore memory = new MemoryDataStore();
        memory.createSchema(schema);
       
        collection.accepts(new FeatureVisitor() {
            public void visit(Feature feature) {
                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(schema);
               
                builder.init((SimpleFeature) feature);
                for (AttributeDescriptor descriptor : newTypes) {
                    builder.add(DataUtilities.defaultValue(descriptor));
                }
               
                SimpleFeature newFeature = builder.buildFeature(feature.getIdentifier().getID());
                memory.addFeature(newFeature);
            }
        }, null);
       
        return memory.getFeatureSource(typename);
       
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
View Full Code Here

   * </pre></code>
   */
  protected void setUp() throws Exception
  {
    gf = new GeometryFactory();
    mds = new MemoryDataStore();
    namespace = getName();
    vr = new TempFeatureResults();

    lineFeatures = new SimpleFeature[4];
    ls0 = gf.createLineString(new Coordinate[]{  new Coordinate(0,0),
View Full Code Here

     *
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        store = new MemoryDataStore();
        store.addFeatures(roadFeatures);
        store.addFeatures(riverFeatures);
    }
View Full Code Here

  /*
   * @see TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();
    store = new MemoryDataStore();
    store.addFeatures( roadFeatures );
    store.addFeatures( riverFeatures );
    processor = new ValidationProcessor();   
    results = new RoadNetworkValidationResults();   
  }
View Full Code Here

       
        SimpleFeature[] features=new SimpleFeature[]{
           b.buildFeature(null)
        };
       
        return new MemoryDataStore(features);
    }
View Full Code Here

    public void testSameCRS() throws Exception {
        CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
        GeometryFactory fac=new GeometryFactory();
        Point p = fac.createPoint(new Coordinate(10,10) );
       
        MemoryDataStore ds = createDatastore(crs, p);
       
         FeatureReader<SimpleFeatureType, SimpleFeature> original = ds.getFeatureReader(FEATURE_TYPE_NAME);
       
        ForceCoordinateSystemFeatureReader modified = new ForceCoordinateSystemFeatureReader(ds.getFeatureReader(FEATURE_TYPE_NAME), crs);
       
        SimpleFeature f1=original.next();
        SimpleFeature f2=modified.next();
       
        assertEquals(f1,f2);
View Full Code Here

TOP

Related Classes of org.geotools.data.memory.MemoryDataStore

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.