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();
List<SimpleFeature> hits = spatialIndex.query(envelope);
for (int i = 0; i < hits.size(); i++) {
    SimpleFeature feature= hits.get(i);
    // Here, calculate the distance of this feature to another feature
somehow
} 


So either way I have to narrow it down to a set of collections then iterate
through the list looking for what I want?
-- 
View this message in context: 
http://n2.nabble.com/Beginner-question-about-feature-query-tp4295864p4295864.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to