Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-14 Thread Michael Bedward
2010/1/14 tommy408 wrote: > > You're right, in my test using filter with datasource was faster for some > reason. > The power of a spatial index :) Good to hear things are working for you. cheers Michael -- Throughout i

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-13 Thread tommy408
Yes you answered my question Michael. You're right, in my test using filter with datasource was faster for some reason. Thank you mbedward wrote: > > Hello, > >> Suppose I'm running the query a lot so I loaded all the geometries into >> FeatureCollection. > > Sorry - do you mean load all fe

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-13 Thread Michael Bedward
Hello, > Suppose I'm running the query a lot so I loaded all the geometries into > FeatureCollection. Sorry - do you mean load all features into memory or a subset of them ? If you are working with a very large number of features in a database with a spatial index I think it can be faster to que

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-12 Thread tommy408
Thank you for your help. Suppose I'm running the query a lot so I loaded all the geometries into FeatureCollection. FeatureCollection collection = ds.getFeatureSource( "all_polygons" ).getFeatures( filter ); And I'm doing queries like: check if this LineString intersect a polygon in another pol

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-12 Thread Michael Bedward
Sorry - I see that actually the dud line was duplicated by a correct one in the original post. Coffee time. -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class ap

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-12 Thread Michael Bedward
oops, this line certainly doesn't make sense... FilterFactory2 ff = CommonFactoryFinder it should be... FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); -- This SF.Net email is sponsored by the Verizon D

Re: [Geotools-gt2-users] Beginner question about feature query

2010-01-12 Thread Michael Bedward
Hello, Here's one way that you might do it... // create map and manually set params for your database Map connectionParams = ... // alternatively use the GeoTools swing module JDataStoreWizard JDataStoreWizard wizard = new JDataStoreWizard( new PostgisDataStoreFactory() ); int result = wizard.sh

[Geotools-gt2-users] Beginner question about feature query

2010-01-12 Thread tommy408
I've been using Postgis and normally if I want to look for a nearest geometry I would do something like Select the_geom From all_polygons Where ST_Distance(the_geom, new_geom) < 10 How would I do it using geotools? Would it be something like this? final SpatialIndex spatialIndex= new STRtree()