|
From: César M. I. <ces...@gm...> - 2009-12-21 15:19:14
|
Hello list,
I'm using Sextante through the GeoTools-Sextante bindings to create a
Graticule (using CreateGraticuleBuilder algorithm form Sextante).
This creates a shapefile containing a graticule of rectangles.
However, performance is really poor: ~ 63 minutes to just write around
14000 features.
The relevant part of code is:
FeatureStore<SimpleFeatureType, SimpleFeature> store =
((FeatureStore<SimpleFeatureType, SimpleFeature>) getFeatureSource());
List<Object> attributes = new ArrayList<Object>();
attributes.add(geom);
attributes.addAll(Arrays.asList(values));
SimpleFeatureType ft = store.getSchema();
FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
FeatureCollections
.newCollection();
SimpleFeature feature = SimpleFeatureBuilder.build(ft, attributes,
SimpleFeatureBuilder.createDefaultFeatureId());
collection.add(feature);
store.addFeatures(collection);
Note that "geom" is a JTS geometry, and "values" is an Object[].
I've been measuring times, and 99% of the time is spent in the last line:
store.addFeatures(collection);
Is there a better way to achieve this with GeoTools or should I bypass
the FeatureStore layer in GeoTools and go directly to ShapefileWriter?
I would really appreciate any clue on this.
Regards,
César.
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
César Martínez Izquierdo
GIS developer
- - - - - - - - - - - - - - - - - - - -
ETC-LUSI: http://etc-lusi.eionet.europa.eu/
Universitat Autònoma de Barcelona (SPAIN)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|