Skip to content

Filter Data with GeoServer

Jun Wang edited this page Apr 5, 2022 · 5 revisions

Filter Data in WMS/WFS Query in Maptool

Data query/filtering in Maptool is done by using Filtering in GeoServer. Due to the size of the data, the query on sources and sinks are done differently.

  • Sources: WFS requests, to specify the features to be returned in geojson.
  • Sinks: WMS requests, to select which features should be displayed on a map.

Filter Sources

Source query in done by function apply_filters in index.html.

A sample query generated in the function:

https://simccs.org/geoserver/SimCCS/ows?service=WFS&version=1.0.0&request=GetFeature&maxFeatures=10000&outputFormat=text/javascript&format_options=callback:loadsearchresult&typeName=Sources_082819_SimCCS_Format&cql_filter=((strToLowerCase(Name) like '%Indiana%') AND (Type IN ('Electricity (Coal)','Electricity (Gas)','Ethanol','Iron/steel')) AND (Capturable BETWEEN 2 AND 20) AND (costVar___ BETWEEN 25 AND 82.5) AND (Intersects(the_geom,Polygon((-100.06347656250001 39.842286020743394,-70.79589843750001 39.842286020743394,-70.79589843750001 23.42292845506526,-100.06347656250001 23.42292845506526,-100.06347656250001 39.842286020743394)))))&callback=jQuery341007380786870244527_1649167191733&_=1649167191734

Searchable fields in this query: Name, Type, Capturable and costVar___. The default query will be carried out in the current map extent, which is done by Intersects(the_geom,Polygon(...)).

A callback function loadsearchresult is used to display the returned GeoJSON in map.

maptool-source-query

Filter Sinks

Clone this wiki locally