# Generating sampling points - making a series of points in the horizontal centre of a long polygon, equidistant spacing on vertical axis

I have a polygon showing the extent of a beach. I would like to create a series of sampling points along that beach, that are equally spaced north to south (say at increments of 100m to the northing value), and lie in the approximate center of the beach polygon at that northing value.

How might I go about this in QGIS or python? I can find a solution that would achieve this specifically. Thanks for any advice.

• What have you tried so far? May 27, 2020 at 12:36
• I played with cutting the polygon up based on regular spaced horizontal lines, and then generating centroids of each resulting polygon. Wondering if there is an easier way to do it!
– staf
May 27, 2020 at 13:08
• Aha, so you did something similar to what I did in my answer. You can certainly automate this using Graphical Modeler or a Python script May 27, 2020 at 13:11
• Great, thanks for your input Stefan, its an elegant solution
– staf
May 27, 2020 at 13:22
• Thank you! If it solves your issue, please mark it as the solution. :) May 27, 2020 at 13:31

We will create an equally spaced grid, intersect it's horizontal lines with the beach and calculate centroids of each intersection.

## Steps

1. Use a projected coordinates system (such as UTM).
2. Vector > Research Tools > Create Grid
• Grid type: Line
• Grid extent: [...] "Use Canvas Extent" or "Use Layer Extent..."
• Vertical spacing: 100
3. Select by Expression `y_min(\$geometry) = y_max(\$geometry)` to select horizontal lines
4. Vector > Geoprocessing Tools > Intersection
• Input Layer: Grid ([x] "Selected features only")
• Overlay layer: beach
5. Vector > Geometry Tools > Centroids