# How to create a matrix of points inside a polygon with QGIS?

I need to create a matrix of points (e.g. 3.5 x 0.5 meters), with a defined orientation, inside a polygon. Essentially, I have to plan the arrangement of plants in a grove in order to plan an irrigation system.

I appreciate any hints

Antonino

-
do these points represent the plants? So the plants are in rows with 0.5 meters distance, and the rows have a distance of 3.5 meters? – Bernd V. Mar 17 '13 at 16:06
Yes, points represent plants as you described. – Antonino Mar 17 '13 at 16:14
tested a bit, but couldn't find anything automated so far. The problem is to get a grid in the right angle, cause i guess your field is not exactly stretching N-S. So, how wide is your field = how many rows will you have to create? Cause when thats not hundreds, there maybe a nice manual way to do so. BTW. screenshots are always nice to get a better understanding of the matters. – Bernd V. Mar 17 '13 at 17:08
The field have an irregular shape. Now I'm trying to convert a line element into points, so i can use CADTools to create multiple lines and convert them into points – Antonino Mar 17 '13 at 17:17

Cause i don't know the details, i can only give general hints.

I would create 2 helper lines at both ends of the field.

In the SEXTANTE toolbox, there is the function "Densify geometry given interval". Apply this function to the helper lines with an interval of 3.5. This adds new nodes in this interval, so you have an end-vertex for each row.

Create a new line layer for your rows. Set snapping options to the vertices of the helper lines.

Draw your rows from those vertices with 3.5m distance.

Use the same function to densify your rows with the interval of 0.5.

Then use the "Extraxt nodes" function (also in SEXTANTE or through Vector > Geometry Tools) and get a point layer from your rows.

This will of course only work when the field is quite rectangular. If you need curves in your lines, you will need more helper lines in between and carefully position those with a lot of measuring and calculating to get exact results. Using CAD-Tools and/or "Improved Polygon Capturing 2"-plugin to create parallel lines, or lines of fixed lenghts or angle will also help.

-
Great! It works! But I've a question about "Densify geometry given interval", why this function does not accept decimal values? – Antonino Mar 17 '13 at 18:15
@Antonino You can fix that: Locate and open DensitfyGeometriesInterval.py and replace line #51 with: self.addParameter(ParameterNumber(self.INTERVAL, "Interval between Vertices to add", 0.0001, 10000000, 0.0001)) – underdark Mar 17 '13 at 18:43
Thanks Bernd and underdark, you resolved my problem! – Antonino Mar 18 '13 at 14:10

The easiest would be to create the grid for the whole region using the Vector->Reasearch Tools->Vector Grid tool, then clip out the part of the grid that's in the grove using the Vector->Geoprocessing->Clip tool

-
Thanks, but the grid is not exactly what I need. I need a grid of points 3.5 x 0.5 m of distances. Now I'm trying to rotate a grid of point with a mesh of 0.5 m (without results), so thereafter I'll delete surplus point. I appreciate further hints. Thanks! – Antonino Mar 17 '13 at 16:19