1

I currently have a grid system like this which have already thousands of grids.

enter image description here

Now I want to create some sub-grid of this large grid divided into four and the sub-grid id will be like the following convention.

enter image description here

Is there any automation tool that can do this?

I am familiar with QGIS.

Cyril Mikhalchenko
  • 4,397
  • 7
  • 14
  • 45
Devils Dream
  • 3,179
  • 9
  • 44
  • 78
  • Please decide whether it is ArcGIS Pro, ArcMap or QGIS that you wish to ask about in this particular question. – PolyGeo Jul 13 '23 at 11:20
  • It would also help if the pictures you rely on to explain the task were in the body of the Question (those that follow best security practice are not going to follow your links). A screenshot of the image on your workstation should upload without difficulty. Looking for existing tools to do custom tasks takes as much, if not more effort than just coding it. But for us to help, you need to make an attempt. – Vince Jul 14 '23 at 14:26
  • Take a look at https://gis.stackexchange.com/q/386664/107424 – MrXsquared Jul 15 '23 at 14:34

1 Answers1

2

1

Create a new grid using your grids extent as input and with a spacing of half your grid. My start grid spacing is 200 m, so I create a new one with 100 m to get four squares in each.

2

Join attributes by location to join the id (56, 57, 58, 59 in your screenshot) of the large grid to the small grid. Your small grid should be Join to features in layer, and predicate should be are within: enter image description here

My id column in the large grid is named id so I specify it in Fields to add

3

Execute SQL with row_number and char functions:

select *, concat(id_2, '_', char( row_number() over (partition by id_2 order by id_2, st_x(st_centroid(geometry)), -st_y(st_centroid(geometry))) + 64)) as newid
from input1

My joined id column is named id_2 after the Join attributes by location. So change id_2 to the name of your id column in the query above (if it is not id_2).

The query will number each id ordered by id, x centroid coordinate and negative y centroid coordinate and add 64 to produce the numbers 65, 66, 67, 68 and they are converted to A, B, C, D with char function.

4

The output layer will be temporary, save it to disk with Convert format

enter image description here

BERA
  • 72,339
  • 13
  • 72
  • 161