Assistance Needed with Filtering WMS Layers on wms.geo.admin.ch

44 views
Skip to first unread message

farkadi oussama

unread,
Jun 8, 2023, 5:23:02 PM6/8/23
to GeoAdminCh API

Hello,

I am currently working on a project that involves filtering specific points from a WMS layer on the wms.geo.admin.ch. However, I have encountered some difficulties in achieving the desired outcome. I would greatly appreciate your assistance in resolving this matter.

To provide you with more context, I have been using the following URL to access the WMS service:

https://wms.geo.admin.ch/?service=WMS&request=GetMap&layers=ch.bafu.klima-co2_ausstoss_gebaeude&styles=&format=image%2Fpng&transparent=true&version=1.1.1&CQL_FILTER=featureId%3D210195509_0&width=256&height=256&srs=EPSG%3A3857&bbox=955309.979508133,5995109.002462944,955462.8535647034,5995261.876519515

The specific layer I am working with is called "ch.bafu.klima-co2_ausstoss_gebaeude."

I have attempted to apply a filter query using the CQL_FILTER attribute on the "featureId" in order to retrieve a single point. However, every time I execute this query, the entire set of points is returned instead of just the desired one.

Here is an example of the code I have been using:

var roofLayer = L.tileLayer.wms("https://wms.geo.admin.ch/", {
  layers: 'ch.bafu.klima-co2_ausstoss_gebaeude',
  transparent: true,
  format: 'image/png',
  CQL_FILTER: "featureId==210195509_0",
}).addTo(map);


Could you kindly review the provided dtails and implementation and let me know if this is the appropriate approach for applying a filter on the wms.geo.admin.ch layer. If not, I would greatly appreciate your guidance on the correct method to accomplish this task.

Thank you very much for your time and assistance. I look forward to your response.

Best regards,



GeoAdminCh API

unread,
Jun 9, 2023, 3:28:29 AM6/9/23
to GeoAdminCh API
Hello Oussama,

We are serving WMS  using Mapserver, and from what I know the  CQL_FILTER parameter is a proprietary command of Geoserver. Mapserver has an WMS_FILTER parameter.

Regards,

Marc

Reply all
Reply to author
Forward
0 new messages