Package org.geotools.data

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


                        throw new CommandFailedException("A table named '" + tableName
                                + "'already exists. Use -o to overwrite");
                    }
                } else {
                    try {
                        dataStore.createSchema(outputFeatureType);
                    } catch (IOException e) {
                        throw new CommandFailedException("Cannot create new table in database", e);
                    }
                }
View Full Code Here


        params.put(ShapefileDataStoreFactory.URLP.key, shapeFile.toURI().toURL());
        params.put(ShapefileDataStoreFactory.CREATE_SPATIAL_INDEX.key, Boolean.TRUE);

        DataStore dataStore = dataStoreFactory.createNewDataStore(params);
        try {
            dataStore.createSchema(outputFeatureType);

            final String typeName = dataStore.getTypeNames()[0];
            final SimpleFeatureSource source = dataStore.getFeatureSource(typeName);
            checkParameter(source instanceof SimpleFeatureStore,
                    "Could not create feature store. Shapefile may be read only");
View Full Code Here

                } catch (GeoToolsOpException e) {
                    throw new CommandFailedException("No features to export.", e);
                }
            }
            try {
                dataStore.createSchema(outputFeatureType);
            } catch (IOException e) {
                throw new CommandFailedException("Cannot create new table in database", e);
            }
        } else {
            if (!overwrite) {
View Full Code Here

                } catch (GeoToolsOpException e) {
                    throw new CommandFailedException("No features to export.", e);
                }
            }
            try {
                dataStore.createSchema(outputFeatureType);
            } catch (IOException e) {
                throw new CommandFailedException("Cannot create new table in database", e);
            }
        } else {
            if (!overwrite) {
View Full Code Here

                } catch (GeoToolsOpException e) {
                    throw new CommandFailedException("No features to export.", e);
                }
            }
            try {
                dataStore.createSchema(outputFeatureType);
            } catch (IOException e) {
                throw new CommandFailedException("Cannot create new table in database", e);
            }
        } else {
            if (!overwrite) {
View Full Code Here

            ShapefileDataStoreFactory maker, boolean memorymapped) throws IOException,
            MalformedURLException {
        DataStore s;
        s = createDataStore(maker, tmp.toURI().toURL(), memorymapped);

        s.createSchema(type);
        SimpleFeatureStore store = (SimpleFeatureStore) s.getFeatureSource(s.getTypeNames()[0]);

        assertEquals(0, store.getCount(Query.ALL));
        store.addFeatures(one);
        assertEquals(one.size(), store.getCount(Query.ALL));
View Full Code Here

            MalformedURLException, Exception {
        DataStore s;
        String typeName;
        s = createDataStore(maker, tmp.toURI().toURL(), memorymapped);

        s.createSchema(type);

        SimpleFeatureStore store = (SimpleFeatureStore) s.getFeatureSource(s.getTypeNames()[0]);

        store.addFeatures(one);
        s.dispose();
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

        Map<String, Serializable> create = new HashMap<String, Serializable>();
        create.put("url", file.toURI().toURL());
        create.put("create spatial index", Boolean.TRUE);
        DataStore dataStore = factory.createNewDataStore(create);
        SimpleFeatureType featureType = SimpleFeatureTypeBuilder.retype(schema, worldCRS);
        dataStore.createSchema(featureType);

        // carefully open an iterator and writer to process the results
        Transaction transaction = new DefaultTransaction("Reproject");
        FeatureWriter<SimpleFeatureType, SimpleFeature> writer =
                        dataStore.getFeatureWriterAppend(featureType.getTypeName(), transaction);
View Full Code Here

        Map<String, Serializable> create = new HashMap<String, Serializable>();
        create.put("url", file.toURI().toURL());
        create.put("create spatial index", Boolean.TRUE);
        DataStore newDataStore = factory.createNewDataStore(create);

        newDataStore.createSchema(featureCollection.getSchema());
        Transaction transaction = new DefaultTransaction("Reproject");
        SimpleFeatureStore featureStore;
        featureStore = (SimpleFeatureStore) newDataStore.getFeatureSource(typeName);
        featureStore.setTransaction(transaction);
        try {
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.