5

I'm looking to replicate the kind of map seen here, where there are essentially multiple hex grids nested inside one another.

map
Author : Kate Berg

That example was made in ArcGIS Pro, whereas I'm working in QGIS 3.20. I have gotten as far as creating a couple of separate hex grid layers and tried tinkering with the offsets of the top layer. However that only moves the top layer and doesn't have the shrinking effect I'm after.

3 Answers 3

9

Step 1. Create a grid with the "Create grid" geoalgorithm

step_1

Step 2. Use the "Geometry by expression" from the Processing Toolbox (Ctrl+Alt+T).

With the following expression:

make_regular_polygon(
    centroid($geometry),
    end_point(
        line_substring(
            make_line(
                point_on_surface(
                    boundary($geometry)
                    ),
                centroid($geometry)
                ),
            0,
            0.25 -- specify a step here 
            )
        ),
    6,
    0
    )

and get the output:

result1

In case if more hexagons are required apply the following expression:

collect_geometries(
    array_foreach(
        generate_series(
            0,
            distance(centroid($geometry), point_on_surface(boundary($geometry))),
            0.25 -- specify a step here
            ),
        make_regular_polygon(
            centroid($geometry),
            end_point(
                line_substring(
                    make_line(
                        point_on_surface(
                            boundary($geometry)
                            ),
                        centroid($geometry)
                        ),
                    0,
                    @element 
                    )
                ),
            6,
            0
            )
        )
    )

and get a corresponding answer:

result2

Keep in mind that each output feature is a MultiPolygon, so the application of the "Multipart to singleparts" tool can be useful.

single_part


References:

2
  • 1
    This a really well-written and thorough answer, thanks. Commented May 20, 2022 at 9:59
  • 1
    I've also come across another solution which I will post seperately. Commented May 20, 2022 at 10:00
6

Create an hexagonal grid then add some centroid fill using hexagonal symbol. you may control the colour of each symbol by using data override on each symbol.

enter image description here

Edit :

If you don't have hexagon symbol you may use this (just save the code as text file with a .svg extension :

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 113.4 113.4">
<polygon fill="param(fill) #9D9D9C" fill-opacity="param(fill-opacity)" stroke="param(outline)) #3C3C3B" stroke-opacity="param(outline-opacity)" stroke-width="param(outline-width) 0.25" stroke-miterlimit="1" points="78,19.9 99.2,56.7 78,93.5 35.4,93.5 14.2,56.7 35.4,19.9 "/>
</svg>
4
  • I don't see a hex symbol out-of-the box, but I'm sure I added a plug-in with additional svgs, so I'll check that out too. Commented May 20, 2022 at 9:56
  • 1
    on my version (3.24) the simple Marker include hexagon shape see my edit
    – J.R
    Commented May 20, 2022 at 10:14
  • Aha, I obviously need to update then, as ususing centroids like you suggested was one thing I wanted to try. Commented May 20, 2022 at 11:00
  • 1
    @MattHouston Iedited my answer to add SVG symbol
    – J.R
    Commented May 20, 2022 at 12:30
2

Whilst @Taras has provided a great answer , I wanted to share another solution I came across - the "Shape Tools" plugin.

Not only could I edit the shape of my hexes, but I could also rotate them which was another issue I was having.

Specifically the tool I used was 'Geodesic transformations'.

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.