MapThat & GeoServer – Apply a CQL Filter

Marketing
Marketing
  • Updated

By David Crowther

MapThat___GeoServer___Apply_a_CQL_Filter_-_1.png

Question:

Does MapThat allow you to apply CQL Filters to WMS Layers Table?

Answer:

Yes, MapThat can render any OGC compliant WMS layer, including external and internal WMS layers that you may create via GeoServer.

For your own internal WMS layers, you simply need to reference the GeoServer Server URL and the GeoServer Layer Name when creating the MapThat WMS URL. In this example , we have a CRIME WMS layer called lcc_crimes_2018_12_all within our GeoServer instance.

MapThat___GeoServer___Apply_a_CQL_Filter_-_2.png

For this example, this would be the MapThat compatible URL -

MapThat___GeoServer___Apply_a_CQL_Filter_-_3.png

And when shown in MapThat the WMS renders to show all the different types of crimes -

MapThat___GeoServer___Apply_a_CQL_Filter_-_4.png

If you wish to then have separate MapThat WMS Layers for each crime type, you could create individual WMS layers within GeoServer, for example, here is the Burglary WMS layer in GeoServer -

MapThat___GeoServer___Apply_a_CQL_Filter_-_5.png

Where in GeoServer you would add a CQL filter in the Layer Data Properties to create the Burglary WMS from the FULL CRIME Table -

MapThat___GeoServer___Apply_a_CQL_Filter_-_6.png

You would then reference this individual GeoServer Burglary WMS in your MapThat layer -

MapThat___GeoServer___Apply_a_CQL_Filter_-_7.png

And the Burglary layer would show in MapThat -

MapThat___GeoServer___Apply_a_CQL_Filter_-_8.png

However, this would mean you would need to create ALL the INDIVIDUAL WMS layers in GeoServer first, which can be time consuming –

MapThat___GeoServer___Apply_a_CQL_Filter_-_9.png

Instead, you can simply create one GeoServer Crime WMS Layer –

MapThat___GeoServer___Apply_a_CQL_Filter_-_10.png

And then in the separate MapThat WMS Layers, you can apply the filter on the fly per MapThat Layer. For example, below is the WMS URL needed for the Burglary MapThat layer -

MapThat___GeoServer___Apply_a_CQL_Filter_-_11.png

The URL is the same as the FULL CRIME layer, but in MapThat we have added the &CQL_FILTER… applying the filter where type=’Burglary’

Once applied to your MapThat layer, the layer will reference the FULL CRIME WMS, but will filter on the fly to only show the crimes where their type = ’Burglary’

MapThat___GeoServer___Apply_a_CQL_Filter_-_12.png

So, using the CQL FILTER on the end of the MapThat WMS URLS allows you to create multiple MapThat layers using one single GeoServer WMS!

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.