3

I would like to use GPS coordinate of one point and create a hexagonal grid layer around it where it is at the exact middle of a hexagon.

When using MMQGIS it produces a hexagonal grid on the current window and produces something like the attached.

The green point is a layer with one GPS coordinate.

I can get it roughly to the centre by moving the window around but I was wondering if there is a more precise way of doing this?

From the other options in the grid layer window (see attached) custom area seems the most promising.

However I am not sure how to use this to get the green point in the middle?

And it obviously depends on how large a grid I what.

enter image description here

UPDATE:

I have solved this when using a square grid but the Hexagon grid is still giving me trouble - mainly because I do not understand what the X spacing term relates to?

First I will go step by step through a rectangle grid:

  1. In the grid window I change the units to degrees
  2. For this example I set X spacing (Longitude) at 0.0001 and Y spacing (Latitude) at 0.0001 - this sets up the size of each rectangle or in this case square.
  3. Select Custom Area from Extent drop down
  4. My point coordinates that I want to base the grid around are: S -6.58361, E 38.84678

  5. Say we want 10 grid squares width in every direction from the point. We know my grid squares are 0.0001 degrees (WxL) thus ten grid squares will be 0.001. Thus the custom area can be set as follows:

Top Y = -6.58361 + 0.001 Bottom Y = -6.58361 - 0.001 Left Y = 38.84678 - 0.001 Right Y = 38.84678 + 0.001

  1. We are not quite there as the middle of a grid is the intersection of four grid squares so we need to offset everything by half a square (see attached for result):

Top Y = -6.58361 + 0.001 + 0.00005 Bottom Y = -6.58361 - 0.001 + 0.00005 Left Y = 38.84678 - 0.001 + 0.00005 Right Y = 38.84678 + 0.001 + 0.00005

For the Hexagon I thought I could do a similar thing however there are a couple of problems. Because to of the shape Y and X spacing are related and if you change one the other changes. If I set Y to 0.0001 the grids come out as the the same hight as the previous example (this makes sense) however at this setting X spacing is 0.0000866 - I have no idea what this relates to? I have tried to measure various things on the Hexagon but nothing matches. The width of the Hexagon is larger the the hight not smaller as indicated by the settings.

enter image description here

  • just to confirm, you want to shift the whole grid so that the green point is at the centre of a hex cell? – Steven Kay Jun 16 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.