[MapServer-users] filtering the data based on postgis attributes

Marcin Niemyjski mniemyjski at cloudferro.com
Tue Nov 28 06:32:29 PST 2023


Hello,
I would like to define several dimensions for filtering my WMS (Web Map Service). They are based on a PostGIS table from which the service is exposed. Here lies my problem because among the required information to expose, I need to provide the following to the map server:

  *   wms_dimensionlist: (Mandatory)
  *   wms_[dimensionname]_item: (Mandatory)
  *   wms_[dimensionname]_units: (Mandatory)
  *   wms_[dimensionname]_extent: (Mandatory)
  *   wms_[dimensionname]_default: (Optional)

My issue arises because I want to filter my data based on the "product_id" column containing a string. The table is large, so it's not possible to provide all the ID values to "wms_productid_extent."

So, I thought about using https://mapserver.org/cgi/runsub.html#table-of-contents, but the problem arises with the implementation in the query. I would like to lead to a situation where if I don't provide any filtering parameters (product_id, cloud_cover), the entire data set is returned.

I do not want to use this:
DATA 'geometry from (select * from mrc order by maxcc desc) where pid = '%pid%' as subquerry using unique unique_id using srid=3857'
because if I do not provide pid, my query wiill not work.


So, to summarize I'm looking for something like this:


DATA 'geometry from (select * from mrc order by maxcc desc) as subquerry using unique unique_id using srid=3857'

VALIDATION
    'maxCC' '^[0-9](1, 3)$'
    'tile' '^.{6}$'
    'pid' '^.{65}$'
END

No default values (except time), if none is provided Mapserver does not filter the data (except time).

Best,
Marcin
[https://res.cdn.office.net/assets/bookwithme/misc/CalendarPerson20px.png]<https://outlook.office.com/bookwithme/user/6347c7def05a478ba013ae948648789d@cloudferro.com?anonymous&ep=signature>           Book time to meet with me<https://outlook.office.com/bookwithme/user/6347c7def05a478ba013ae948648789d@cloudferro.com?anonymous&ep=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20231128/d6785bd2/attachment.htm>


More information about the MapServer-users mailing list