Pages

Tuesday, 18 October 2011

Nothing to see here

A couple new abilities for the GeoTools filter system.
WFS2 includes two ways to check if an attribute does not have a value.
  • PropertyIsNull can be used to check that a property exists; and that the value is empty.
  • PropertyIsNil is used to check if a property exists at all
A quick example makes this difference easier to see:
    // test if "approval" equals "null"
    filter = ff.isNull(ff.property("approved"));
    // this example checks if approved exists at all
    filter = ff.isNil(ff.property("approved"),"no approval available");

I also found that I had missed documenting how FeatureId can be used to look up a feature by name; or at least identifier.
The example makes use of a Set of FeatureId to construct the appropriate Filter:

    Set selected = new HashSet();
    selected.add(ff.featureId("CITY.98734597823459687235"));
    selected.add(ff.featureId("CITY.98734592345235823474"));
    filter = ff.id(selected);

Documentation harmed in the making of this post:

No comments: