I tried to use setFilter method in mapbox but this method is used to filter existing layer's features depending on specific property but not filtering all layers according to geometry In other words, I need to filter the layers depending on geometry type (Point, LineString, Polygons)
You could get all layers of a style with
var layers = map.getStyle().layers
and then filter depending on the layer type (e.g.
Here's an official example which shows how to find the id of the first symbol layer in a map style:
The following screenshot is taken from there: