A layer can only contain one type of geometry: either points or polygons (or lines), but not both.
However, using Geometry generators, you can create symbolization (visualization, not actual geometries) of another geometry type.
Let's say you have a polygon layer named poly
with an attribute polygon_species
and a point layer point
with an attribute point_species
.
On the polygon layer, add a new symbol layer of type Geometry generator / Geometry type: point
and insert this expression. When you then (manually) select a polygon, all the points containing the same attribute value are created as additional symbols on the polygon layer (see screenshot):
with_variable (
'selected',
attribute('polygon_species'),
if (
is_selected( ),
aggregate(
'points',
'collect',
$geometry,
filter:=point_species=@selected
),
''
)
)
Polygon layer: blue, initial point layer: light blue dots; selected polygon (B) highlighted in yellow, points with the same attribute (B) highlighted in big red dots (style can be changed manually as you like. If you toggle visibility of the point layer, only the red B_points will be visible (as long as polygon B is selected):