# How can I get repeated vector grid in horizontal direction?

I need to get repeated vector grid layer in horizontally direction. I created many polygon vector grid layers, and their extents as listed bellow (Xmin-Ymin, Xmax-Ymax):

Layer 1: 5910000 3040000 6010000 2940000

Layer 2: 6020000 3040000 6120000 2940000

Layer 3: 6130000 3040000 6230000 2940000

Layer 4: 5910000 2930000 6010000 2830000

Layer 5: 6020000 2930000 6120000 2830000

Layer 6: 6130000 2930000 6230000 2830000

The extents difference horizontally and vertically was 100000 as appeared, and the parameter was 10000, and the result was exactly what I needed after I let the system to label my grid automatically by ID, starting from ID: 0 to ID: 120 for each layer.

The problem is that, if I needed to cover more area on the map, then I will be in need for a large number of layers to be set manually, and this will be a frustration!

So, Is there any way to tell the software to create a repeated layers horizontally, from the left to the right, and once it reach the end of the map, it needs to go vertically one step by a certain amount of extents difference?

`Note: all of my layers are same in their parameters and extents differences, only the extents must be repeated in a constant shift, which it 100000 here.`

This pic. might be enough to clarify my request:

EDIT

I did like what Andre instructed, and the result was like this:

Now, I have some inquiries:

1. why the labeling is going from bottom to top not from top to bottom?
2. Why the labeling didn't start from the very left of the layer (blue rectangle)? and it also didn't start from the very top of the layer!
3. Why labeling didn't start from 1 to 100 instead of 11 to 110?
• Have you tried using `Vector > Research Tools > Vector Grid`?
– Aaron
Commented Feb 5, 2014 at 4:26
• @Aaron Of course I did, and the given pic is a result of 6 Vector grid layers..and here the problem! I need a faster way to create such an approach instead of making a lot of vector grid layers..
– MRAN
Commented Feb 5, 2014 at 9:03

Is it necessary that your Layers contain 11x11 fields?

It would make it easier if you could have 10x10 fields.

You could create one polygon grid for the whole area of your interest; then label the small rectangles from 1 to 100 with the field calculator, and add the layer name in a second column.

Same for the layer grid with a raster 10 times greater.

Instead of creating a bunch of Layers I would prefer to have one layer, and filter the data to the layer you are working on with the second column created.

But I am not sure what you intend to do with the rectangles.

EDIT

This is what I think you want:

Created with `Vector -> Research Tools -> Vector grid` on top of Openstreetmap via Openlayers plugin using EPSG:3857

The black grid with 10000 meters spacing, the red one 100000 meters. Labelling with a custom function:

10km grid:

`````` round( ( "YMIN" /100000- floor( "YMIN" /100000))*10)*10+round( ( "XMIN" /100000- floor( "XMIN" /100000))*10)
``````

100km grid:

``````round( ( "YMIN" /1000000- floor( "YMIN" /1000000))*10)*10+round( ( "XMIN" /1000000- floor( "XMIN" /1000000))*10)
``````

The number is always the 5. / 6. digit from the left of the EPSG:3857 coordinates Y and X packed together.

You can use the same functions to populate additional columns of the attribute table.

• It sounds great, 10x10 is enough. How can I label the small rectangles from 1 to 100 with the field calculator? I lost a bit! Could you rephrase the steps using a list of steps with accurate guidelines, please? I appetite your understanding; because my knowledge is down with such a software! I will tell you my intention after I finish my project:)
– MRAN
Commented Feb 5, 2014 at 14:53
• Would you check my question update, please?
– MRAN
Commented Feb 5, 2014 at 18:20
• The way I numbered the polygons is the simpliest way by extracting the 5. digit from the right. You can play around with the functions if you do not like it... Commented Feb 5, 2014 at 18:44
• Sorry, What do you mean by "extracting the 5. digit from the right"? and what about the labeling from top to bottom? Thank you.
– MRAN
Commented Feb 5, 2014 at 19:02
• From the coordinates y=3030000 x=5910000 of the bottom left edge of a polygon I take the 3 and the 1 and get the ID 31. You can calculate with 3040000-ymax instead of ymin to get it from top to bottom. Commented Feb 5, 2014 at 19:13

Aaron is correct. If you have a vector which the grid needs to cover, you can use the Vector Grid tool to make a grid with a specified grid size to cover the desired vector. Additionally, you can enter the coordinates that you want the grid to cover.

• I tried that already and here is the problem! I don't need to repeat the process `Vector > Research Tools > Vector Grid` thousands of times to get the desired result as shown in the picture..
– MRAN
Commented Feb 5, 2014 at 9:05