Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureWriter


    public static SimpleFeatureWriter simple(final FeatureWriter w) {
        if (w instanceof SimpleFeatureWriter) {
            return (SimpleFeatureWriter) w;
        }

        return new SimpleFeatureWriter() {

            @Override
            public SimpleFeatureType getFeatureType() {
                return (SimpleFeatureType) w.getFeatureType();
            }
View Full Code Here


        }

        create(e, collection.getSchema());

        Transaction tx = new DefaultTransaction();
        SimpleFeatureWriter w = writer(e, true, null, tx);
        SimpleFeatureIterator it = collection.features();
        try {
            while(it.hasNext()) {
                SimpleFeature f = it.next();
                SimpleFeature g = w.next();
                for (PropertyDescriptor pd : collection.getSchema().getDescriptors()) {
                    String name = pd.getName().getLocalPart();
                    g.setAttribute(name, f.getAttribute(name));
                }
                                            
                w.write();
            }
            tx.commit();
        }
        catch(Exception ex) {
            tx.rollback();
            throw new IOException(ex);
        }
        finally {
            w.close();
            it.close();
            tx.close();
        }

        entry.init(e);
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureWriter

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.