TransWikia.com

Search multiple GeoServer layers by conditions

Geographic Information Systems Asked by Loki on December 13, 2020

I need a bit of help with GeoServer and querying information.

For example, I would like to search GeoServer for Locations where Location has specific fields:

My build-up query would look like:

 WHERE type ILIKE 'Gas'   OR  (   borehole_s ILIKE 'Prod'   AND   planned_td ILike '0'   )  ) 

type, borehole_se & planned_td are fields of Features on Layers, but I would like to search across multiple layers.

Is something like that even possible? I have read that using CQL Filter is a good set.

My query should look simmilar to this one:

layers=layer1,layer2,layer3 cql_filter=layer1.prop_name1 = 1 AND layer2.prop_name2 = 2 OR layer3.prop_name3 = 3

Is that possible with geoserver ?

One Answer

You can specify a CQL filter for each layer in your request by separating them with ;

So for your example:

layers=layer1,layer2,layer3&filter=prop_name1=1;prop_name2=2;prop_name3=3

Each filter element is independent of the other filters so you don't have to option of using AND or OR to chain them.

Correct answer by Ian Turton on December 13, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP