I am making a global map in qGIS 3.1 using proportional symbology with the following:

  • Data = Number of hospitalizations - classified as 'Real' type
  • Symbology = Single Symbol: Fill -> Centroid fill -> Marker -> Simple Marker

For Size under 'Simple Marker' I have checked the assistant tool and selected my hospitalizations variable as the source. Unfortunately I can't figure out how to produce a legend for this. All solutions I'm seeing direct people back to 'Marker' and then 'Advanced' for 'Data defined size legend' but I do not have this option, only says Symbol Levels.

enter image description here


You must convert your polygon layer to a point layer. The "Data Defined Size Legend" is only available when using point layers.

If you use a polygon with a Centroid Fill from polygon and use the Assistant on Size, no "Data Defined Size Legend" will be available.

It's an annoying limitation in QGIS IMHO but at least you know where your problem comes from.

For the polygons to points, 3 solutions:

  1. To convert polygons to point layers, you can use either "Point on surface" or "Centroids" algorithms in the Processing Toolbox. Main drawback = need to generate again and again the points from your polygons if there are changes.
  2. To get dynamic layer from your polygon point, you may use "QGIS virtual layers" with a recipe more less like below.

Virtual layer point on surface

  1. Use a VRT (use XML based declarations to abstract other data sources) with the following
    <OGRVRTLayer name="ne_50m_admin_0_countries">
        <SrcDataSource relativeToVRT="1">ne_50m_admin_0_countries.geojson</SrcDataSource>
        <SrcSQL dialect="SQLITE">SELECT *, st_pointonsurface(geometry) AS geometry1 FROM ne_50m_admin_0_countries</SrcSQL>
        <GeometryField name="geometry1">

If you should choose between option 2 and 3, it's mainly about portability: virtual layers in QGIS = exclusive to QGIS whereas VRT ("Virtual Format") easy to move, portable with all solutions compatible with OGR/GDAL and it ecosystem.

  • Thanks, I was able to use Centroids algorithm in the Processing Toolbox and it worked great. All good now with a usable legend
    – tp_chav
    Jun 12 '20 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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