In this scenario, we will create an index map from scratch, using a grid of 15-minute quads for the state of Colorado. We’ll use the Stamen Toner basemap for reference, because the state boundaries are easier to see.
A 15-minute quad is 15/60 or 1/4 of a degree, so we need to create a rectangular grid where each cell is 0.25 degrees wide and tall. To cover all of Colorado, so we’ll need to figure out the lat/lon bounds of the state.
...> Select extent on canvas, then drag a rectangle covering Colorado
Let’s suppose we have a Colorado map series that uses these quads, and each map is number A1, A2, A3 across the top row, and A1, B1, C1 down the left column, like this:
Although we could just add a new column and type in the value for every cell, that would be very tedious and prone to error. With some experimentation, we can figure out a formula for calculating the code for each cell.
Use the Identify tool to look at the attributes for one of the grid cells. Notice that it includes values for the left, top, right, and bottom coordinates of the cell.
QGIS dynamic label expressions can help us to figure out the formula in an iterative manner. The complete formula is below, but here is the sequence used to figure it out. After typing to change the
top expression, just press “tab” or click elsewhere and the labels will update on the map.
top*4(to get whole numbers)
165-top*4(so that the top row is 1, and the numbers increase southwards)
char(64 + 165-top*4)(this converts the numbers to letters – char(65) is A, char(66) is B, etc.)
char(64 + 165-top*4) || (left*4)(this appends numbers based on the longitude)
char(64 + 165-top*4) || (437 + left*4)(so that the left column is 1, and increases to the east)
Once the expression is generating the correct codes, we can copy it and use it to create a new column.
Now the code is just another field that could be used when we run “Refactor Fields”.
When in edit mode, other fields could be added and edited while viewing the attribute table.
Next: Exercise 4