Though not specific to Google Earth, GeoServer has the ability to filter data returned from the Web Map Service (WMS). The KML Reflector will pass through any WMS
cql_filter parameter to GeoServer to constrain the response.
Filters are basically a translation of a SQL “WHERE” statement into web form. Though limited to a single table, this allows users to do logical filters like “AND” and “OR” to make very complex queries, leveraging numerical and string comparisons, geometric operations (“bbox”, “touches”, “intersects”, “disjoint”), “LIKE” statements, nulls, and more.
There simplest filter is very easy to include. It is called the
featureid filter, and it lets you filter to a single feature by its ID. The syntax is:
where <feature> is the feature and its ID. An example would be:
This request will output only the state of Maryland. The feature IDs of your data are most easily found by doing WFS or KML requests and examining the resulting output.
Using filters in a URL can be very unwieldy, as one needs to include URL-encoded XML:
Instead, one can use Common Query Language (CQL), which allows one to specify the same statement more succinctly:
This query will return all the states in the US with areas between 100,000 and 150,000 km^2.