L3DB6H

Lloyd Bosworth : archaeologist | human | beard

This QGIS tutorial is part of a series detailing my journey moving from ArcGIS to QGIS and how I’ve relearned familiar ArcGIS workflows. I’ve been using ArcGIS for many years and the move to QGIS has at times presented quite a steep learning curve. Some of what I have learned has come from trial and error, but the greater majority has come from searching forums and other blogs and I try to credit these sources as I go along. Writing these articles is both a personal aide-memoire and a way to cement the new skills I am learning, but if they are helpful to others, then all the better.

QGIS tutorial for archaeologists wanting to create survey grids and export as points to use with a GPS or Total Station.

Creating and Orienting Vector Grids in QGIS 2.18

In this QGIS tutorial I will use a real-life geophysical survey to detail how I use QGIS to create polygon grids, how I orientate them to fit the area of interest and how I export the grid as points to use with a GPS or Total Station system.

In archaeology, laying out a grid before a survey or excavation is an essential part of keeping a fieldwork project organised. Grids can be aligned to real-world coordinates, such the British National Grid here in the UK, or can be on an arbitrary alignment, called a site grid, chosen to best fit the terrain or landscape. A site grid will commonly use a field boundary, verge, fence line or other linear feature as a baseline from which to measure out the grid.

Gridding out, as it’s called, can be done quickly in the field by one or two people using surveyor’s tapes. I’m fortunate to have access to a GPS Rover which can achieve the same result as using hand tapes, but much more quickly and with millimetre accuracy. The other benefit of using a GPS is that the grid can be created in QGIS in the office and transferred precisely onto the field.

QGIS Tutorial Contents

  1. Creating the grid
  2. Orienting the grid
  3. Converting polygons to points
  4. Exporting point layers
  5. How does this workflow compare with ArcGIS?

Creating the grid1

  1. Either search for grid in the Processing Toolbox, or navigate to Vector grid under QGIS geoalgorithms > Vector creation tools.
  2. Define the extent of the grid by clicking the three dots to the right of the input field and choosing Select extent on canvas. You’ll be taken back to your map where you can select a rectangular area by left clicking and dragging.
  3. X spacing and Y spacing defines the size of your grid squares in map units.
  4. Set the Grid type to polygons or lines as you prefer.
  5. Leave the Grid field as [Create temporary layer]. You can save this layer as a shape file once we have it aligned correctly, but it’s not necessary.
  6. Click Run.

You’ll now have a temporary layer containing your newly created grid. I would normally change the polygon fill to transparent, thicken the outline to make it more visible and also choose a contrasting colour so that it stands out better from the background.

Creating a polygon vector grid in QGIS

The polygon vector grid dialogue box in QGIS

 

Once the grid has been created, change the polygon fill to transparent, thicken the outline to make it more visible and also choose a contrasting colour so that it stands out better from the background.

Once the grid has been created, change the polygon fill to transparent, thicken the outline to make it more visible and also choose a contrasting colour so that it stands out better from the background.

Orienting the grid

Selected objects in QGIS are by default highlighted in yellow.

  1. With the Select Features tool, drag a polygon marquee over the new grid to select all.
  2. If your selection is displayed as solid yellow, go to Project > Project properties (Ctrl+Shift+P) and under the General tab change the Selection color to transparent2.
  3. The next step uses the Rotate Feature (Advanced Digitizing Tools) and Move Feature tools to reposition the grid along a baseline, typically a field boundary or hedge line. With the Rotate Feature tool, left click the selected grid once to activate the rotate tool and then free rotate the grid to align it with your area of interest, left clicking once more to deactivate the rotate tool. With the Move Feature tool, left click and drag the grid to reposition it more precisely. Redo these steps until you are satisfied with the result.
  4. All that’s left to do now is delete any unwanted grid squares that fall outside of the area of interest. With the Select Features by Freehand tool, in an editing session, simply Ctrl + left click each unwanted grid square and then hit delete.
  5. Save your edits and end the editing session.
  6. Right click the grid layer and select Save as and choose ESRI Shapefile as the Format.
The vector grid has been rotated and moved so that it aligns with the southern field boundary. This boundary is the chosen baseline from which the grid can be measured out with tapes.

The vector grid has been rotated and moved so that it aligns with the southern field boundary. This boundary is the chosen baseline from which the grid can be measured out with tapes.

If you aren’t using a GPS system to stakeout the grid and are using tapes instead, then you are done. All that remains is to measure to a location on the grid, e.g., to a grid corner, or to the edge of the grid adjacent to the map feature you used as your baseline, and use these measurements to locate the edge of the grid in the field.

If you are using a GPS system, then you need to convert the polygon grid to a point grid and export this point layer to a format that the GPS controller can understand. In this example, I will be using the CSV format, or Comma Separated Value.

Converting polygons to points

I’ve found two ways to create points from polygon features, one way sounds easy, but isn’t, the other sounds time consuming but can be much quicker.

The first way is to use the Vector > Geometry Tools > Extract nodes3. The dialogue for this tool asks which polygon layer is to be used and the type of layer in which the points are to be created. Clicking run immediately adds a new layer with points at each grid intersection. Brilliant! But for some reason, and I have no idea why, it creates multiple points for each intersection that need to be manually selected and deleted. This turns what should be a simple job into one that can consume quite a lot of time.

The second method is to create a new point shape layer and manually add a point at each grid intersection. This usually turns out to the quickest method, but can become quite laborious on larger grids.

Convert a polygon vector grid to points using Extract Nodes in QGIS

Convert a polygon vector grid to points using Extract Nodes in QGIS

 

A new point layer was created and points drawn at each grid intersection.

A new point layer was created and points drawn at each grid intersection.

Exporting point layers

Whichever of the two above methods you used, the end result is the same. Right click the new point layer and choose Save As. In the dialogue that opens, under Format, choose Comma Separated Value [CSV], choose a file name and then hit Save.

If you ran the Extract nodes tool, you’ll find that when you view the CSV file in Excel, there are extra columns called xmin, xmax, ymin and ymax. These can be deleted. The coordinates in the X and Y columns are in the coordinate system of your map.

Saving the point layer as a CSV file for use with a GPS or Total Station.

Saving the point layer as a CSV file for use with a GPS or Total Station.

How does this workflow compare with ArcGIS?

This is an easy win for QGIS. Often, ArcGIS can perform tasks with built in tools that QGIS requires third-party plugins to achieve. In this case, ArcGIS (I’m using 10.3) requires a third-party plugin (ET GeoWizards) to create a grid, as I’ve found no way to perform this task with built-in tools alone. The only way I can see to do this in ArcGIS is to draw a single polygon and use copy/paste to build up the grid. This is the kind of repetitive task that computers are supposed to free us from!

QGIS exports points more efficiently than ArcGIS too, as it includes coordinates for each point by default. While exporting points in ArcGIS is not difficult, you must first create X and Y columns in the layer’s attribute table, then use the Calculate Geometry tool to extract the coordinates for each point.

arrow-left ArcGIS - Merge Multiple Rasters Using Cell Statistics
Previous post

  • lukelo mgana

    March 30, 2017 at 6:13 am | Reply

    i learned new things .
    thanks for sharing this this nice knowledge
    i prefer to get every thing you post about GIS.
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *