I have a bunch of data in a MemoryDataStore, which I now want to write out to
a shapefile.

The way I am trying to do it is listed below, but perhaps there's a  
better way...


        FeatureSource fs = ml.getFeatureSource(); //existing feature  
source from MemoryDataStore
         FeatureType ft = fs.getSchema();
         String ftName = ft.getTypeName();
         try
         {
           IndexedShapefileDataStore dataStore = new    
IndexedShapefileDataStore(f.toURI().toURL());
           dataStore.createSchema(ft);
           dataStore.forceSchemaCRS(currentCRS);

  .....>> ???How to I set the features from fs in dataStore? <<---------

           FeatureWriter aWriter =  
dataStore.getFeatureWriter(ftName,((FeatureStore)dataStore.getFeatureSource(ftName)).getTransaction());
           aWriter.write();
           logMessage(Constants.INFO, "Layer saved to " + f.getName());
         } catch (Exception e) {
           logMessage(Constants.ERROR, e.getMessage());
         }


-- 
************************************************************************
       http://www.chimere.org/      http://walbatross.blogspot.com
************************************************************************
**     Throw the radio up high / Watch us drown out half the sky      **
**       Synaesthesia coloured blue / Aquaman knows what to do        **
************************************************************************

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to