To solve this problem, we’re first going to get a grid of points over Vancouver Island that we can then import into ClimateNA, where we will be able to pull our climate data from.
Pull in an OSM layer
This will allow us to see where we need to start drawing!
Create a new vector layer
We’ll want to draw out a polygon around Vancouver Island, our study area.
- Create a new vector layer.
- Provide a file name.
- Select
Polygon
for the Geometry type. - Add a new field called
Study area
and keep the defaults for data type and length. - Hit
Ok
.
Draw your polygon
- Select the layer you just created.
- Select the pencil to edit the layer.
- Select the
draw polygon
tool. - Go to town with as much or as little detail as you’d like. Your left mouse button will create a new point. When you’re done, your right mouse button will close the loop.
- Select the pencil icon again to save your changes. If you don’t save your changes now, your grid point creation will fail.
Generate a grid of points
We want to generate a point for every kilometre.
- Go to your
Processing Toolbox
(availbale underView > Panels
if not already visible). - Search for
Create grid
and open the dialogue box. - Set the
Grid type
toPoint
.Grid extent
to match your polygon layer.- Horizontal and Vertical spacing to
1 Kilometer
- Select
run
. This will probably take just shy of 2 minutes. - Admire the big colourful box blocking your view of the Island.
Clean up the grid
We only need those grid points that are actually on Vancouver Island, so we’ll get rid of the excess.
- In your toolbox, search for
Intersection
. - For the
Input layer
, select your point grid you just created. - For the
Overlay layer
select your polygon trace of the Island. - Give your new data set a file name and select
Run
- In your layers panel, uncheck the first grid layer you created, and voila, you’ve got your island back.
Reproject your data
One small issue now. We spaced our grid at 1km intervals. But e need to know the decimal degree coordinates of our grid points for ClimateNA. So we’ll convert the projection from one based on metres (EPSG:3857) to one that uses decimal degrees (EPSG:4326).
- In your toolbox, search for
Reproject layer
. - In the dialogue box, select your Island point layer for the
Input layer
- Ensure the
Target CRS
is set toEPSG:4326 - WGS 84
- Give your new layer a file name to be saved to and select
Run
Get your lat and long
Your attribute table at this point won’t look much different for this new layer. While it’s now in a different CRS, we still need to input the lat and long into the attribute table.
- Open the attribute table for your latest layer.
- Select the pencil to edit the attribute table.
- Select the
Open field calculator
icon. - In the
Output field name
type something to indicate that this is yourlat
measure. - In the
Output field type
, selectDecimal number (real)
. - In the
Expression
box type$y
, that is, the y-intersect. - Hit
Ok
and give it a second to run. - Repeat this process, calling the second field something like
long
and using the x-intersect -$x
- in theExpression
box.
Get your elevation data
Export your data to csv
We’ll need our lat, long, and elevation in csv for import into ClimateNA.
- Right click on your degree decimal layer and select
Export > Save Features As...
- In the dialogue box, for
Format
, selectcsv
. - Provide a reasonable file name
- Ensure the
CRS
is set toEPSG:4326 - WGS 84
- Hit
Ok
You’re all ready to get some climate data now for each of your coordinates. Yay!