I'm running a query that test a line if it crosses any polygon in a table,
and if it doesn't I keep it.  And it test 2600 lines.

In postgres with postgis I run this query 2600 times ( different lines)
which takes 300 milliseconds:

PERFORM gid from terrains where ST_Crosses(v_line , the_geom) limit 1;
IF NOT FOUND THEN
 // then keep
END IF;


With geotools I run this code for the same purpose which takes 1922
milliseconds:

Filter intersectFilter = CQL.toFilter("CROSS(the_geom, " +  lineString +
")");
Filter bboxFilter = ff.bbox(ff.property( "the_geom" ), envelope  );
Filter andFilter = ff.and(bboxFilter ,intersectFilter);
FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
terrainPolygonSource.getFeatures( andFilter);
                                
if ( collection.size() == 0)
  // then keep lineString

What am I doing wrong here? And I already loaded those geometries into
memory. I only run the time test for this portion of the code.  Is this the
best I can get?


-- 
View this message in context: 
http://n2.nabble.com/Running-crosses-postgis-vs-geotools-tp4349406p4349406.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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to