Examples of SimpleFeatureStore


Examples of org.geotools.data.simple.SimpleFeatureStore

        final String typeName = dataStore.getTypeNames()[0];
        final SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        if (!(featureSource instanceof SimpleFeatureStore)) {
            throw new CommandFailedException("Could not create feature store.");
        }
        final SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;

        Function<Feature, Optional<Feature>> function = getTransformingFunction(dataStore
                .getSchema());

        ExportDiffOp op = cli.getGeogig().command(ExportDiffOp.class).setFeatureStore(featureStore)
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

                final SimpleFeatureSource featureSource = dataStore.getFeatureSource(tableName);
                if (!(featureSource instanceof SimpleFeatureStore)) {
                    throw new CommandFailedException(
                            "Could not create feature store. Data source is read only.");
                }
                final SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
                if (overwrite) {
                    featureStore.removeFeatures(Filter.INCLUDE);
                }
                ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
                        .setPath(path).setFeatureTypeConversionFunction(function);
                try {
                    op.setProgressListener(cli.getProgressListener()).call();
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

            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");
            final SimpleFeatureStore store = (SimpleFeatureStore) source;
            ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(store)
                    .setPath(path).setFeatureTypeConversionFunction(function);
            try {
                op.setProgressListener(cli.getProgressListener()).call();
                cli.getConsole().println("OSM data exported successfully to " + shapeFile);
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

            int random;
            synchronized (rnd) {
                random = rnd.nextInt();
            }
            final String typeName = pointType.getTypeName();
            SimpleFeatureStore featureSource;
            int insertCount = 0;
            try {
                for (int i = 0; i < numInserts; i++) {
                    builder.reset();
                    builder.set("sp", String.valueOf(random));
                    builder.set("ip", Integer.valueOf(random));
                    SimpleFeature feature = builder.buildFeature(String.valueOf(random));

                    featureSource = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
                    Transaction tx = new DefaultTransaction();
                    featureSource.setTransaction(tx);
                    try {
                        featureSource.addFeatures(DataUtilities.collection(feature));
                        tx.commit();
                        insertCount++;
                    } finally {
                        tx.close();
                    }
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

        SimpleFeatureSource featureSource = dataStore.getFeatureSource(tableName);
        if (!(featureSource instanceof SimpleFeatureStore)) {
            throw new CommandFailedException("Can't write to the selected table");
        }
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        if (overwrite) {
            try {
                featureStore.removeFeatures(Filter.INCLUDE);
            } catch (IOException e) {
                throw new CommandFailedException("Error accessing table: " + e.getMessage(), e);
            }
        }
        ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

        SimpleFeatureSource featureSource = dataStore.getFeatureSource(tableName);
        if (!(featureSource instanceof SimpleFeatureStore)) {
            throw new CommandFailedException("Can't write to the selected table");
        }
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        if (overwrite) {
            try {
                featureStore.removeFeatures(Filter.INCLUDE);
            } catch (IOException e) {
                throw new CommandFailedException("Error accessing table: " + e.getMessage(), e);
            }
        }
        ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

        }

        Function<Feature, Optional<Feature>> function = getTransformingFunction(dataStore
                .getSchema());

        final SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
                .setPath(path).setFilterFeatureTypeId(featureTypeId).setAlter(alter)
                .setFeatureTypeConversionFunction(function);
        // shapefile transactions are memory bound, so avoid them
        op.setTransactional(false);
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

            featureSource = dataStore.getFeatureSource(tableName);
        } catch (IOException e) {
            throw new CommandFailedException("Can't aquire the feature source", e);
        }
        if (featureSource instanceof SimpleFeatureStore) {
            SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
            if (overwrite) {
                try {
                    featureStore.removeFeatures(Filter.INCLUDE);
                } catch (IOException e) {
                    throw new CommandFailedException("Error trying to remove features", e);
                }
            }
            ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

            final SimpleFeatureSource source = dataStore.getFeatureSource(tableName);

            if (!(source instanceof SimpleFeatureStore)) {
                throw new CommandFailedException("Could not create feature store.");
            }
            final SimpleFeatureStore store = (SimpleFeatureStore) source;
            if (overwrite) {
                try {
                    store.removeFeatures(Filter.INCLUDE);
                } catch (IOException e) {
                    throw new CommandFailedException("Error truncating table " + tableName, e);
                }
            }
            ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(store)
View Full Code Here

Examples of org.geotools.data.simple.SimpleFeatureStore

        final String typeName = dataStore.getTypeNames()[0];
        final SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
        if (!(featureSource instanceof SimpleFeatureStore)) {
            throw new CommandFailedException("Could not create feature store.");
        }
        final SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
        ExportOp op = cli.getGeogig().command(ExportOp.class).setFeatureStore(featureStore)
                .setPath(path).setFilterFeatureTypeId(featureTypeId).setAlter(alter);

        op.setTransactional(false);
        if (defaultType) {
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.