David Gadbois wrote:
> Hi.  I am using GeoTools 2.4.4.  I have a ReferencedEnvelope, and I am 
> trying to create a org.opengis.filter.spatial.Contains filter to see if 
> a feature's geometry contains the envelope.
A RefernecedEnvelope is a bounding box; there is a special optimized 
filter for handling bounding boxes - the BBOX filter.
> I tried:
>
> ReferencedEnvelope bounds = ...;
> FilterFactory2 ff = 
> CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
> PropertyName propertyName = ff.property("the_geom");
> Literal geometry = ff.literal(bounds);
> Filter filter = ff.contains(propertyName, geometry);
>
> But this fails trying to encode the envelope.  What is the preferred way of 
> converting the envelope into some geometrical object that can be encoded?
>   
If you need to do this ever (you don't because you are going to use the 
bbox filter right now) you can produce a polygon by considering the four 
corners of the bounding box.

Jody

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to