I have an external WFS source serving mixed geometry types – in other words, I have no control of the source. When adding the layer QGIS sets the geometry type to line and thus I am unable to style the points and polygons also contained within the layer.
Nathan W states in a comment that a layer in QGIS can contain only one geometry type. If I was able to explicitly set the geometry type on a layer, I could add the layer three times and use one layer for each geometry type.
Is it possible to force the geometry type on a (WFS) layer in QGIS?
Or is there another method I could use to correctly style all the features in my WFS layer?
Best Answer
In QGIS 3.6 this is not possible if adding the WFS through the browser panel. However, if you add the WFS through Layer > Add Layer > Add WFS Layer you are then able to apply SQL to the layer.
So, from scratch, do the following:
geometryType(geom_field) = 'LineString'
replacing geom_field with the name of the field that stores the geometry. You should be able to find this in the Columns dropdown to the right. Geometry options include Point, MultiPoint, LineString, LinearRing, MultiLineString, Polygon, MultiPolygon, GeometryCollectionClick OK.I couldn't find this anywhere and have figured it out myself using part of the answer to this question as a starting point. I hope it helps others looking for the same workaround until QGIS makes it a bit easier.