I think what you are asking for is called a "spatial join"; geotools does not 
have that as part of our filter syntax; the best solution is a series of nested 
for loops as shown here:
- http://docs.geotools.org/latest/userguide/library/main/collection.html#join


-- 
Jody Garnett

On Wednesday, 4 May 2011 at 12:17 PM, LeeHyung Joo - Kevin wrote: 
> 
> 
> Hi All.
> 
> I want to ask something about query.
> 
> 
> The thing what I want to do is below:
> 
> ---------------------------------
> | |
> | |
> | |
> | district |
> | |
> | ----------------|----------------
> | |***************| |
> | |***************| |
> | |***************| |
> | |***************| |
> | |***************| |
> | |***************| |
> --------------------------------- |
>  | |
>  | |
>  | buildings |
>  | |
>  | |
>  ---------------------------------
> 
> There are two tables : district, buildings.
> 
> I want to extract data of symbol part.
> 
> 
> The query is below :
> --------------------------------------------------------
> select building_name 
> from district, buildings 
> where ST_Contains(district.the_geom, buildings.the_geom) 
> AND buildings.building_name='Somewhere';"
> --------------------------------------------------------
> 
> 
> 
> I input the_geom of district to variable "res".
> 
> And some of my code is :
> 
> ----------------------------------------------------------------------------------------
> FeatureSource<SimpleFeatureType, SimpleFeature> fs2 = 
> ds.getFeatureSource("buildings");
> FeatureCollection<SimpleFeatureType, SimpleFeature> fc2 = fs2.getFeatures();
> Filter filter2 = (Filter) CQL.toFilter( "CONTAINS(the_geom, res)" );
> DefaultQuery q2 = new DefaultQuery("buildings", filter2);
> fc2 = ds.getFeatureSource("buildings").getFeatures(q2);
> FeatureIterator<SimpleFeature> fi2 = fc2.features();
> 
> while(fi2.hasNext()) {
>  SimpleFeature sf2 = fi2.next();
>  System.out.println(sf2.getAttribute("building_name"));
> ----------------------------------------------------------------------------------------
> 
> It is occured error at "CQL.toFilter( "CONTAINS(the_geom, res)" );"
> 
> These codes can be fixed all... Please don't hesitate answer..
> 
> 
> Thanks in advanced.
> 
> 
> 
> Best Regards.
> Kevin Lee.
> 
> 
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network 
> management toolset available today. Delivers lowest initial 
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> 
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to