Consider the following code: ShapefileDataStore sds = new ShapefileDataStore(somefileURL); FeatureStore fstore = (FeatureStore) sds.getFeatureSource(sds.getTypeNames()[0]);
Transaction trans = new DefaultTransaction(); fstore.setTransaction(trans); fstore.removeFeatures(someFilter); // each filter removes exactly one feature. trans.commit(); trans.close(); The above code (error handling part removed for clarity) is extremely slow and is almost unacceptable for a shapefile that has just 20k features. The method removeFeatures(someFilter); alone takes about a second or two. Compare this with addFeatures which is very fast. In a simple test, I tried to remove 10k entries using the above code in batches of 1000 features. It took more than 3 hours. Addition took 7 minutes. I was able to speed it up by using an or-filter and supplying a single filter for every 1000 features. It worked very well. But I need to preserve the sequence of adds and deletes on the datastore and therefore, cannot assume that I can batch all deletions. A batch can have addFeatures and removeFeatures call. Please advise how I can speed this up. -- View this message in context: http://www.nabble.com/Slow-Shapefile-Deletion-tf3904616.html#a11070446 Sent from the geotools-gt2-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
