|
From: Nano S. <nan...@gm...> - 2009-12-19 10:33:55
|
Thanks Michael!
What I mean "faster" is faster for zooming, panning, and generally in
responding. The quickstart app gave slow response while I am loading a
certain shapefile (perhaps it's too big?). With the FeatureCollection
you just showed, it is much better now.
On Sat, Dec 19, 2009 at 5:11 PM, Michael Bedward
<mic...@gm...> wrote:
> Hi Nano,
>
> Forgive me for answering your question with a question but faster for what ?
>
> If you can provide some information about your application, ie. the
> types of operations that you are doing with the data, it would help
> folk here suggest approaches that are relevant to your case.
>
> Meanwhile, here is the Quickstart main method, modified to load all
> features into memory before displaying them. You might like to try
> this with your data.
>
> public static void main(String[] args) throws Exception {
> // display a data store file chooser dialog for shapefiles
> File file = JFileDataStoreChooser.showOpenFile("shp", null);
> if (file == null) {
> return;
> }
>
> FileDataStore store = FileDataStoreFinder.getDataStore(file);
> FeatureSource featureSource = store.getFeatureSource();
>
> FeatureCollection<SimpleFeatureType, SimpleFeature> memColl =
> FeatureCollections.newCollection();
> memColl.addAll(featureSource.getFeatures());
>
> // Create a map context and add our shapefile to it
> MapContext map = new DefaultMapContext();
> map.setTitle("Quickstart");
> map.addLayer(memColl, null);
>
> // Now display the map
> JMapFrame.showMap(map);
> }
>
>
> Hope this helps,
>
> Michael
>
|