5

I want a grid around my points(100 x 100 m), where points are center. Creating a grid from

Vector --> Research Tools --> Vector Grid

creates grid, but not centered around my points.

How do I do this?

3 Answers 3

10

This way it should work:

  1. Reproject your points to a projected CRS with metres as units (if not already done)
  2. Draw buffers with a radius of 50m (half of the grid size) around them with Vector -> Geoprocessing Tools -> buffer(s)
  3. Create the vector grid with the extent of the buffer layer and 100m spacing
5
  • I think the OP wants a square grid so simple buffers wouldn't work unless you use the old Rectangles, Ovals, Diamonds tool, from 1.8 (not the one in 2.x but the other similar one - sadly not updated) Oct 2, 2014 at 8:36
  • Why should the buffers not work? I only need the extent of the buffer layer. I assume that the points are regularly spaced.
    – AndreJ
    Oct 2, 2014 at 8:37
  • Ah - sorry - I misunderstood. You are creating the buffers merely to get the extent and then making the grid based on that! That makes sense. Oct 2, 2014 at 8:38
  • Is there any way to control the orientation of the grid? I'm looking for something that would have NW and SE orientation, but I'm currently getting "diamond" shaped grid. Oct 5, 2015 at 10:21
  • 1
    @RomanLuštrik you have to set up a custom omerc projection with alpha=45. Then densify the geometry and reproject to something useful.
    – AndreJ
    Oct 5, 2015 at 10:24
2

There are many way to achieve what you want. Here are a few of them (assuming you want a grid of square cells):

  1. Convert your points to a raster with a resolution equal to your grid spacing using a unique ID for the raster value. Each raster cell is then centered on your point. Convert the raster to a polygon vector. You now have a grid (you can convert polygon to lines if required).
  2. Use the Rectangles, Ovals and Diamonds plugin for QGIS 1.8 to create square buffers around each point (there were two tools with similar names. The one in QGIS 2.x is NOT the one you want here - sadly the other one, by the same author, has not been updated for QGIS v2x). To use this you need to add 'width' and 'height' attributes to your points.
  3. Give your points both row and column ids. Convert them to lines using the ids (need to do this twice, once for rows and secondly for culmns). This is NOT what you want so use the v.parallel tool in Grass to create offset lines to effectively 'shift' your grid so that the points are in the middle.
  4. Make a duplicate of your points and use the affine tool to shift your points and then make a grid as per method 3 (or, use the affine tool to shift your grid instead of v.parallel).
  5. Create a layer using numerical digitize or by creating a CSV that contains just four points whose locations are aligned to the extent required for your grid (i.e. half a cell spacing in each direction larger than the extent of your points layer). Then use the tool you already tried. EDIT: this suggestion is analogous to Andre's suggestion (though his is probably slightly simpler)

There will be other approaches as well as the above. Just pick one you like that you think will suit your use-case.

1

Import your data into PostGIS. Create a new geometry column and calculate the vector grid with the ST_Expand function:

    ST_Expand(yourPointGeometry, 100)

Then you can import your data back into QGIS and you will have a vector grid.

1
  • Perhaps you could expand on your answer otherwise it might get flagged for being low quality? =)
    – Joseph
    Jan 22, 2016 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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