I probably should answer my own post by letting you guys know that the
reason why I couldn't get any subfeatures from the original feature
collection was due to the geojson parser having issues with geojson
documents with null geometry attributes.

I guess there are couple of ways to resolve this issue and that's by...
1.  patching geoserver so it doesn't return geojson documents with
null geometry attributes or
2. patch GT's geojson module so it handles null geometries.

Gerson

On Mon, Jul 15, 2013 at 4:40 PM, Gerson Galang <[email protected]> wrote:
> Hi,
>
> I have a feature collection object from a json document that I parsed.
> When I do some further filtering of the features using the
> subCollection method on the FC object, I don't get anything back. I've
> tried a number of CQL combinations but the code just keeps on giving
> me back a SubFeatureCollection with zero features.
>
> Here's my code...
>
>     FeatureJSON featureJSON = new FeatureJSON();
>     FeatureCollection<SimpleFeatureType, SimpleFeature> fc = featureJSON
>         .readFeatureCollection(ClassLoader
>             .getSystemResourceAsStream("wahealth.json"));
>     System.out.println("old size: " + fc.size()); // returns 2
>     String cql = "gtstate = true";
>     // String cql = "sex = 3";
>     // String cql = "hd_id IN (1, 2)";
>     // String cql = "hd_id IN ('1', '2')";
>     // String cql = "varname = 'insufffrt    '";
>     Filter filter = ECQL.toFilter(cql);
>     FeatureCollection<SimpleFeatureType, SimpleFeature> newFC = fc
>         .subCollection(filter);
>     System.out.println("new size: " + newFC.size()); // returns zero
> all the time
>
> And here's the json object I'm running a filter on?
>
> {
>     "type": "FeatureCollection",
>     "features": [
>         {
>             "type": "Feature",
>             "id": "dohwa_hwss_hd.fid--43245823_13fe0b8af65_-713a",
>             "geometry": null,
>             "properties": {
>                 "sex": 3,
>                 "hd_id": 1,
>                 "gtstate": true,
>                 "est_count": 77752.599975,
>                 "varname": "insufffrt    "
>             }
>         },
>         {
>             "type": "Feature",
>             "id": "dohwa_hwss_hd.fid--43245823_13fe0b8af65_-7139",
>             "geometry": null,
>             "properties": {
>                 "sex": 3,
>                 "hd_id": 2,
>                 "gtstate": true,
>                 "est_count": 32409.613198,
>                 "varname": "insufffrt    "
>             }
>         },
>     ]
> }
>
> Is this a bug in the geotools geojson module?
>
> Thanks,
> Gerson

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to