Package org.geotools.data

Examples of org.geotools.data.DataStore.createSchema()


       
        SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
        tb.setName("foo");
        tb.add("geom", Polygon.class);
        tb.add("bar", Integer.class);
        ds.createSchema(tb.buildFeatureType());
       
        SimpleFeatureType ft = ds.getSchema("foo");
        assertNotNull(ft);
       
        //clean up
View Full Code Here


        File tmpFile = getTempFile();
        tmpFile.delete();

        // write features
        DataStore s = new ShapefileDataStore(tmpFile.toURI().toURL());
        s.createSchema(type);
        String typeName = type.getTypeName();
        SimpleFeatureStore store = (SimpleFeatureStore) s.getFeatureSource(s.getTypeNames()[0]);

        store.addFeatures(features);
        s.dispose();
View Full Code Here

        Map<String, Serializable> params2 = new HashMap<String, Serializable>();
        params2.put("file", file2);
       
        CSVDataStoreFactory factory = new CSVDataStoreFactory();
        DataStore duplicate = factory.createNewDataStore(params2);
        duplicate.createSchema( featureType );
       
        FeatureReader<SimpleFeatureType, SimpleFeature> reader;
        FeatureWriter<SimpleFeatureType, SimpleFeature> writer;
        SimpleFeature feature, newFeature;
View Full Code Here

        params.put("filetype", "shapefile");
        DataStore ds = null;
        try {
            ds = DataStoreFinder.getDataStore(params);
            if(ds != null) {
                ds.createSchema(featureType);
                ds.dispose();
                cache.refreshCacheContents();
            }
        } catch(Exception e) {
            throw (IOException) new IOException("Error creating new data store").initCause(e);
View Full Code Here

        b.setSRS("EPSG:4326");
        b.add("geom", Point.class);
        b.add("name", String.class);

        DataStore data = factory.createDataStore(map);
        data.createSchema(b.buildFeatureType());
        data.dispose();

        assertTrue(new File(tmp.getRoot(), "foo.gpkg").exists());
    }
}
View Full Code Here

        SimpleFeatureType type = store.getSchema( "example" );
        SimpleFeatureType type2 = DataUtilities.createType( "duplicate", "id:Integer,geom:Geometry,name:String" );
       
        Query query = new Query( type.getTypeName(), Filter.INCLUDE );
        reader = store.getFeatureReader( query, Transaction.AUTO_COMMIT );
        store.createSchema( type2 );
        writer = store.getFeatureWriterAppend( "duplicate", Transaction.AUTO_COMMIT );
        try {
            while (reader.hasNext()) {
                feature = reader.next();
                newFeature = writer.next();
View Full Code Here

            schema.add(new AttributeDescriptorImpl(new AttributeTypeImpl(new NameImpl("name"),
                    String.class, false, false, null, null, null), new NameImpl("name"), 0, 0,
                    true, ""));
            SimpleFeatureType featureType = new SimpleFeatureTypeImpl(new NameImpl(noGeomFirst),
                    schema, null, false, null, null, null);
            ds.createSchema(featureType);
            featureType = new SimpleFeatureTypeImpl(new NameImpl(noGeomLast), schema, null, false,
                    null, null, null);
            ds.createSchema(featureType);
        } finally {
            if (ds != null) {
View Full Code Here

            SimpleFeatureType featureType = new SimpleFeatureTypeImpl(new NameImpl(noGeomFirst),
                    schema, null, false, null, null, null);
            ds.createSchema(featureType);
            featureType = new SimpleFeatureTypeImpl(new NameImpl(noGeomLast), schema, null, false,
                    null, null, null);
            ds.createSchema(featureType);
        } finally {
            if (ds != null) {
                ds.dispose();

            }
View Full Code Here

        tb.setName("widgets");
        tb.add("type", String.class);
        tb.add("price", Double.class);
        tb.add("geom", Point.class);
        SimpleFeatureType ft = tb.buildFeatureType();
        ds.createSchema(ft);
       
        FeatureWriter fw = ds.getFeatureWriter("widgets", Transaction.AUTO_COMMIT);
       
        WKTReader wkt = new WKTReader();
       
View Full Code Here

      if (!(crs instanceof CoordinateReferenceSystem)) {
        crs = DefaultGeographicCRS.WGS84;
      }
      SimpleFeatureType featureType = buildFeatureType(sName, iShapeType, fields, sFields, (CoordinateReferenceSystem) crs);
      DataStore mds = createDatastore(filename, featureType);
      mds.createSchema(featureType);
      return createLayer(mds, sName, crs);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
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.