简体   繁体   中英

OpenLayers4/ JavaScript: Is ther a way to get all features of an ImageWMS layer?

I want to search a layer for specific properties, so i want to get all features info of the layer for the whole map not for a specific coordinate. For a certain point i use getGetFeatureInfoUrl . Is there a function to get features for the whole layer?

You simply can't or not this way around at least.

You have two choices to maybe bypass the issue depending of your goal(s):

  • If it's just about rendering layer, you can use SLD to style WMS to render WMS only matching you criteria(s). Default WMS layer could be a river with a column river_width. You could only display the layer with river_width > 5m using SLD. However, you will not get the properties except some of them when clicking (like you already do with WMS GetFeatureInfo)

  • If you really want the properties, you may call the WFS endpoint if the WMS layer you use is also available through WFS. In this case, you will use WFS with Filter Encoding or CQL/ECQL filter (only available in GeoServer). If there are too many results or the geometry are too big, it may overload the server or take it to long to return the result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM