Try as I may I cannot figure out this query. I am looking for a collection 
contained by a shape.
Help please..
Gaby

From: Jody Garnett <jody.garn...@gmail.com<mailto:jody.garn...@gmail.com>>
Date: Thursday, 5 February 2015 6:42 pm
To: Gabriella Turek 
<gabriella.tu...@niwa.co.nz<mailto:gabriella.tu...@niwa.co.nz>>
Cc: 
"geotools-gt2-users@lists.sourceforge.net<mailto:geotools-gt2-users@lists.sourceforge.net>"
 
<geotools-gt2-users@lists.sourceforge.net<mailto:geotools-gt2-users@lists.sourceforge.net>>
Subject: Re: [Geotools-gt2-users] Best filtering approach needed


You would do better to go the other way, grab the shape of your suburb and 
create a query asking for the buildings that fall within that polygon.

jody

--
Jody Garnett

On 3 February 2015 at 11:59, Gabriella Turek 
<gabriella.tu...@niwa.co.nz<mailto:gabriella.tu...@niwa.co.nz>> wrote:
Hi all I am currently using CQL to find buildings that fall within a
suburb as follows"

SimpleFeatureCollection  suburbs;

SimpleFeatureCollection fc = buildings.getFeaturesInBoundingBox(null);
                                SimpleFeatureIterator it = fc.features();
try {

while (it.hasNext()) {

    SimpleFeature assetShape = it.next();
    Point theGeom = (Point) assetShape.getDefaultGeometry();
    Filter filter = CQL.toFilter("CONTAINS(the_geom, POINT(" + pt.getX() +
" " + pt.getY() + "))”)
    SimpleFeatureCollection sfc = aggfc.subCollection(filter);
} finally {
                                        it.close();
                                }


I don’t think this is the best way to do this, it seems very slow.
Additionally, I would like to make it shape agnostic, so it also handles
more complex shapes. not just points.
What is the best way to make this generic and faster?
Thanx
gaby



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to