Package org.geotools.data

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


        File tmp = File.createTempFile(layers[0].getName() + "_" + layers[1].getName() + "_diff", ".shp"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        DataStore ds = dsfac.createDataStore(tmp.toURL());
        final SimpleFeatureType newSchema = FeatureTypes.newFeatureType(
                fromLayer.getSchema().getAttributeDescriptors().toArray(
                        new AttributeDescriptor[0]), "diff"); //$NON-NLS-1$
        ds.createSchema(newSchema);
       
        final FeatureSource<SimpleFeatureType, SimpleFeature> fromSource = fromLayer.getResource(FeatureSource.class, monitor);
        final FeatureSource<SimpleFeatureType, SimpleFeature> diffSource = diffLayer.getResource(FeatureSource.class, monitor);
        if (isGeometryCollection(fromSource.getSchema().getGeometryDescriptor())) {
            MessageDialog.openError(display.getActiveShell(), Messages.differenceOp_inputError, fromLayer.getName() + Messages.differenceOp_multiGeoms);
View Full Code Here


            throws Exception {
        final IService service = (IService) target;
        final DataStore ds = service.resolve(DataStore.class, monitor);
        if (!(ds instanceof ShapefileDataStore)) {
            try {
                ds.createSchema(null);
            } catch (UnsupportedOperationException e) {
                if (testing) {
                    error = true;
                    return;
                } else {
View Full Code Here

        try {

            if (ds instanceof ShapefileDataStore) {
                createShapefile(display, monitor, featureType[0], service.getIdentifier());
            } else {
                ds.createSchema(featureType[0]);
                long start=System.currentTimeMillis();
                while( !Arrays.asList(ds.getTypeNames()).contains(featureType[0].getName().getLocalPart() ) && start+5000>System.currentTimeMillis()){
                    Thread.sleep(300);
                }
                       
View Full Code Here

        Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put(ShapefileDataStoreFactory.URLP.key, file.toURI().toURL());
        params.put(ShapefileDataStoreFactory.CREATE_SPATIAL_INDEX.key, true);
       
        DataStore ds = factory.createDataStore(params);
        ds.createSchema(type);
        List<IService> service = CatalogPlugin.getDefault().getServiceFactory().createService(
                file.toURI().toURL());
        for( IService service2 : service ) {
            try {
                if (service2.resolve(DataStore.class, monitor) instanceof ShapefileDataStore)
View Full Code Here

            build.setAbstract(false);
            build.add(Messages.NewServiceConnectionFactory_defaultGeom,com.vividsolutions.jts.geom.Geometry.class);
           
            SimpleFeatureType schema = build.buildFeatureType();
           
            ds.createSchema( schema ); //$NON-NLS-1$
        } catch (Exception e) {
            CatalogUIPlugin.log("Error creating MemoryDatastore or feature type", e); //$NON-NLS-1$
            return null;
        }finally{
            monitor.done();
View Full Code Here

            } catch (IOException e) {
                return "Error communicating with datastore, check connection and availability of service";
            }
           
            try {
                dataStore.createSchema(mapper.getSchema());
            } catch (IOException e) {
                return "Error creating SimpleFeatureType verify that you have write access";
            }
           
            return null;
View Full Code Here

       
        SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
        tb.setName( "widgetsNG" );
        tb.add( "name", String.class );
       
        ds.createSchema( tb.buildFeatureType() );
       
        FeatureWriter fw = ds.getFeatureWriterAppend( "widgetsNG", Transaction.AUTO_COMMIT );
        fw.hasNext();
        SimpleFeature sf = (SimpleFeature) fw.next();
        sf.setAttribute( "name", "one");
View Full Code Here

        DataStore dstore = null;
        File file = null;
        try {
            file = new File(tempDir, schema.getTypeName() + ".shp");
            dstore = new ShapefileDataStore(file.toURL());
            dstore.createSchema(schema);
           
            fstore = (FeatureStore<SimpleFeatureType, SimpleFeature>) dstore.getFeatureSource(schema.getTypeName());
            fstore.addFeatures(collection);
        } catch (IOException ioe) {
            LOGGER.log(Level.WARNING,
View Full Code Here

                schema = DataUtilities.createType(name, spec);
            } catch (SchemaException e) {
                throw new IOException(e);
            }
            DataStore dataStore = (DataStore) parent.store.getDataStore(null);
            dataStore.createSchema(schema);

            FeatureWriter<SimpleFeatureType, SimpleFeature> w =
                dataStore.getFeatureWriterAppend(name, Transaction.AUTO_COMMIT);
            for (Map<String,Object> map : data) {
                SimpleFeature f = w.next();
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

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.