Hello,
I am using Geotools API to write features into new shapefile. This is code
snippet that i use:
DataStoreFactorySpi factory = new ShapefileDataStoreFactory();
Map<String, Serializable> create = new HashMap<String, Serializable>();
create.put("url", routeFile.toURI().toURL());
create.put("create spatial index", Boolean.TRUE);
create.put("charset", "UTF-8");
ShapefileDataStore newDataStore = (ShapefileDataStore)
factory.createNewDataStore(create);
newDataStore.createSchema(TYPE);
newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
Transaction transaction = new DefaultTransaction("create");
String typeName = newDataStore.getTypeNames()[0];
FeatureStore<SimpleFeatureType, SimpleFeature> featureStore;
featureStore = (FeatureStore<SimpleFeatureType, SimpleFeature>)
newDataStore.getFeatureSource(typeName);
featureStore.setTransaction(transaction);
try {
featureStore.addFeatures(collection);
transaction.commit();
shapefileCreated = true;
} catch (Exception problem) {
problem.printStackTrace();
transaction.rollback();
} finally {
transaction.close();
}
I got shapefile created, however i also got these warnings:
[java] Jan 29, 2010 11:11:27 AM
org.geotools.data.shapefile.ShapefileDataStore createSchema
[java] WARNING: PRJ file not generated for null CoordinateReferenceSystem
[java] Jan 29, 2010 11:11:27 AM
org.geotools.data.shapefile.indexed.ShapeFileIndexer buildQuadTree
[java] INFO: Building quadtree spatial index with depth 1 for file
/tmp/route_1744695.qix
Also i got these warnings periodically:
[java] WARNING: Couldn't flush user prefs:
java.util.prefs.BackingStoreException: Couldn't get file lock.
[java] Jan 29, 2010 11:24:27 AM java.util.prefs.FileSystemPreferences
syncWorld
Can someone help me, i don't know why i get these exceptions and
should i be worried about this.
Best regards.
--
View this message in context:
http://n2.nabble.com/Geotools-WriteToShapefile-tp4479194p4479194.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users