Package org.geotools.data.shapefile

Examples of org.geotools.data.shapefile.ShapefileDataStoreFactory$ShpFileStoreFactory


        pack();

        // docs start file menu
        fileMenu.add(new SafeAction("Open shapefile...") {
            public void action(ActionEvent e) throws Throwable {
                connect(new ShapefileDataStoreFactory());
            }
        });
        fileMenu.add(new SafeAction("Connect to PostGIS database...") {
            public void action(ActionEvent e) throws Throwable {
                connect(new PostgisNGDataStoreFactory());
View Full Code Here


        /*
         * Get an output file name and create the new shapefile
         */
        File newFile = getNewShapeFile(file);

        ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();

        Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put("url", newFile.toURI().toURL());
        params.put("create spatial index", Boolean.TRUE);

        ShapefileDataStore newDataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);

        /*
         * TYPE is used as a template to describe the file contents
         */
        newDataStore.createSchema(TYPE);
View Full Code Here

        // grab all features
        SimpleFeatureCollection featureCollection = featureSource.getFeatures();

        // And create a new Shapefile with a slight modified schema
        DataStoreFactorySpi factory = new ShapefileDataStoreFactory();
        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");
View Full Code Here

        query.setCoordinateSystemReproject(map.getCoordinateReferenceSystem());

        SimpleFeatureCollection featureCollection = featureSource.getFeatures(query);

        // And create a new Shapefile with the results
        DataStoreFactorySpi factory = new ShapefileDataStoreFactory();

        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);
View Full Code Here

        if(tempDir != null)
            deleteDirectory(tempDir);
    }
   
    FileStoreFactory getFileStoreFactory() {
        return new ShapefileDataStoreFactory.ShpFileStoreFactory(new ShapefileDataStoreFactory(),
                Collections.singletonMap(ShapefileDataStoreFactory.NAMESPACEP.key, NSURI));
    }
View Full Code Here

      if(!destination.delete())
        throw new IOException("The provided destination maps to an existing file that cannot be deleted:"+destination);
    }
   
    // real work
    final DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    params.put("url", destination.toURI().toURL());
    params.put("create spatial index", Boolean.TRUE);
 
    ShapefileDataStore store=null;
    Transaction transaction=null;
    try{
      store = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);
      store.createSchema(fc.getSchema());
     
      final SimpleFeatureStore featureStore =(SimpleFeatureStore) store.getFeatureSource(fc.getSchema().getName());
      transaction=featureStore.getTransaction();
     
View Full Code Here

    return file;
  }

  public File exportLayer(String layerName, File file) throws Exception {
        file = checkFile(file);
        ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
        Map<String, Serializable> create = new HashMap<String, Serializable>();
        URL url = file.toURI().toURL();
        create.put("url", url);
        create.put("create spatial index", Boolean.TRUE);
        create.put("charset", "UTF-8");
        ShapefileDataStore shpDataStore = (ShapefileDataStore) factory.createNewDataStore(create);
        CoordinateReferenceSystem crs = null;
    try (Transaction tx = neo4jDataStore.beginTx()) {
      SimpleFeatureType featureType = neo4jDataStore.getSchema(layerName);
            GeometryDescriptor geometryType = featureType.getGeometryDescriptor();
            crs = geometryType.getCoordinateReferenceSystem();
View Full Code Here

        if (datastorePropertiesFile.exists()) {
            Properties datastoreProperties = loadProperties(datastorePropertiesFile);
            String SPIClass = datastoreProperties.getProperty("SPI");
            return (DataStoreFactorySpi) Class.forName(SPIClass).newInstance();
        } else {
            return new ShapefileDataStoreFactory();
        }
    }
View Full Code Here

        } finally {
            IOUtils.closeQuietly(ifos);
        }

        //create a new shapefile feature store
        ShapefileDataStoreFactory shpFactory = new ShapefileDataStoreFactory();
        DirectoryDataStore dir = new DirectoryDataStore(mosaic.getFile(),
            new ShapefileDataStoreFactory.ShpFileStoreFactory(shpFactory, new HashMap()));

        try {
           dir.createSchema(typeBuilder.buildFeatureType());
View Full Code Here

      if(!destination.delete())
        throw new IOException("The provided destination maps to an existing file that cannot be deleted:"+destination);
    }
   
    // real work
    final DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    params.put("url", destination.toURI().toURL());
    params.put("create spatial index", Boolean.TRUE);
 
    ShapefileDataStore store=null;
    Transaction transaction=null;
    try{
      store = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);
      store.createSchema(fc.getSchema());
     
      final SimpleFeatureStore featureStore =(SimpleFeatureStore) store.getFeatureSource(fc.getSchema().getName());
      transaction=featureStore.getTransaction();
     
View Full Code Here

TOP

Related Classes of org.geotools.data.shapefile.ShapefileDataStoreFactory$ShpFileStoreFactory

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.