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?

  • I think it should be possible to use the WFS service filter capabilities to filter the FeatureTypes depending on whether it is gml:Point, gml:LineString, gml:Polygon, etc then use this as the basis of individual layers
    – nmtoken
    Jul 1, 2014 at 9:35
  • It really seems to be possible if the WFS server is Geoserver docs.geoserver.org/stable/en/user/filter/function.html. However, all WFS servers may not support filtering by geometry type. Another option could be to use GDAL VRT format and let it take care of filtering for example with SQLite SQL dialect and (untested) SrcSQL like SELECT * from WFS_layer WHERE GeometryType(geometry)='POINT'
    – user30184
    Jul 1, 2014 at 15:03
  • Did you ever get this to work? I'm somewhat surprised this isn't built into QGIS yet, as multiple geometries are within ogc spec.
    – auslander
    Jun 22, 2017 at 3:34
  • @auslander, No sorry, I didn't find a way and left the issue back then.
    – Chau
    Jun 23, 2017 at 8:21
  • 1
    I can't; it's on an internal network. However, I am not looking for GeoServer filtering; I am looking for QGIS filtering. From what I can tell, QGIS does not allow me to access a URL with filters added from the WFS handler - the handler takes a base WFS URL, and then arguments/filters are added in a SQL-like expression builder. I have been unable to find any documentation on this particular feature of QGIS.
    – auslander
    Jun 27, 2017 at 14:06

2 Answers 2


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:

  • After you select Layer > Add Layer > Add WFS Layer, in the next window select New to add a new service.
  • Enter a Name and the URL of the service.
  • Click the Basic tab and enter your credentials if required.
  • Leave the WFS Options settings as default and click OK.
  • If you entered credentials you will receive a warning about storing passwords. Press OK to continue.
  • Click Connect to connect to the newly added service and highlight the layer you want and click Build query.
  • In the Where clause add 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.
  • Click Add to add the layer to the map.
  • Click Close to return to map.

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.


As far as I know, this is currently not possible but there is already a related feature request: https://github.com/qgis/QGIS/issues/25269

Checking just now with the bag:verblijfsobject example from comments:

    <xsd:extension base="gml:AbstractFeatureType">
            <xsd:element maxOccurs="1" minOccurs="0" name="identificatie" nillable="true" type="xsd:decimal"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="oppervlakte" nillable="true" type="xsd:decimal"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="status" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="gebruiksdoel" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="openbare_ruimte" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="huisnummer" nillable="true" type="xsd:decimal"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="huisletter" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="toevoeging" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="postcode" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="woonplaats" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="actualiteitsdatum" nillable="true" type="xsd:dateTime"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="bouwjaar" nillable="true" type="xsd:decimal"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="pandidentificatie" nillable="true" type="xsd:decimal"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="pandstatus" nillable="true" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="geometrie" nillable="true" type="gml:PointPropertyType"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="pandgeometrie" nillable="true" type="gml:GeometryPropertyType"/>

A query like the following (where we don't select the point geometry), as part of the connection information within the Data Source Manager | WFS > Build Query, results in the points being returned.

SELECT verblijfsobject.identificatie, verblijfsobject.oppervlakte, verblijfsobject.status, verblijfsobject.gebruiksdoel, verblijfsobject.openbare_ruimte, verblijfsobject.huisnummer, verblijfsobject.huisletter, verblijfsobject.toevoeging, verblijfsobject.postcode, verblijfsobject.woonplaats, verblijfsobject.actualiteitsdatum, verblijfsobject.bouwjaar, verblijfsobject.pandstatus, verblijfsobject.pandgeometrie FROM verblijfsobject

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.