VASkO-4 wrote:
> 
> 
> 
> Marie Lambois wrote:
>> 
>> Thanks your code helped me a lot !
>> Didn't you mixed up X and Y in the ReferencedEnveloppe ?
>> 
> Thanks for the finding. I fixed the bug, and it's working ok, but not
> perfect. BBOX checking doesn't deliver good behavior. 
> If two linestrings are nearby, their bboxes overlap and the filter returns
> both. I need a filter, that would check if the click occured at or very
> near the line of each Linestring. Bounding box just includes to much
> surrounded geometry.
> 

I just want to inform you, I came up with a perfect solution. I'm checking
intersections of the schedule linestring and the linestring made of the
edges of the bounding box around clicked point. Finally the app is working
as I wish. See the solution below and use it if you want :)

Coordinate[] poly = new Coordinate[] {new Coordinate(mapX_min, mapY_min),
new Coordinate(mapX_min, mapY_max),
new Coordinate(mapX_max, mapY_min),
new Coordinate(mapX_max, mapY_max) };

GeometryFactory gf = new GeometryFactory();
FilterFactory2 ff =
CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
Filter filter = ff.intersects(ff.property("the_geom"),
ff.literal(gf.createLineString(poly)));
                                        
-- 
View this message in context: 
http://www.nabble.com/ways-to-get-Features-with-click-tp18799656p18879709.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to