Adding data
Last updated
Last updated
We will now finally start to use QGIS! In these exercises we will add 3 different kinds of vector datasets to a QGIS project, as well as some raster data at the end.
Just follow the steps through, which should all have helpful screenshots and pieces of advise as you go along.
There are a few different ways to add data into your QGIS project. We will now try 2 different ways while adding 1 shapefile and 1 geopackage into a new QGIS project.
Open a new QGIS project (Project ➤ New). This will be your main working project for this whole tutorial. Save it in the same folder which currently holds your data for the tutorial (Project ➤ Save or Save As)
Click on Layer ➤ Add Layer ➤ Add Vector Layer
3. Click the 3 little dots, circled in the image below and then navigate to where you have saved the files
4. We will add a shapefile first. Navigate to the course data package you downloaded, click on the .shp file for the coastline medium res dataset, click open, and then add. If the window does not automatically close, click close, and the file should be displayed in your map window!
Don't worry if the coastline is a strange colour for now. Colours are randomly assigned as you add data and we'll go through symbology in the next exercise.
Next, we'll add a geopackage! This time though, we'll add it through the Browser Panel.
5. Browse/navigate to the location of your data within the Browser Panel. This panel is like a file explorer, but just for geospatial data. You should see 'Home' where you can find your desktop, or you should also see your C drive, if that's where your data folder is saved.
6. Locate the contour geopackage, open the file as shown in the screenshot below by clicking on the small arrow on the left, add this file into your project either by dragging and dropping into the Layers Panel or the Map View, or by right clicking and selecting 'add layer to project'
You can save your data folder as a 'favourite' to make it easier to locate it in the Browser Panel for future exercises. To do this, right click on the folder, and select 'Add as a favourite'
7. If everything has gone well, you should now have 2 datasets displayed in your main Map View panel. Try adding data again just for practice, but the other way around. Add the contours through the Layer tab, and add contours through the Browser Panel.
It does not matter which way you add data. You can add it whichever way you find easiest. You can also add data simply by dragging and dropping it from a folder on your computer as well! Select the file in your file manager (windows explorer, finder, etc) and drag it into your QGIS project. Try this, before moving on.
8. If you practiced adding data in different ways, remove the extra data before moving on to the next section, so that you end up with 1 copy of each dataset again. To do this, right click on the layer in the Layers Panel, and click 'Remove Layer'. Save your project.
It is very common to have data contained in spreadsheets or CSVs. For example, locations of sample sites, field sites or fuel depots that you want shown on a map. We will now practice adding a CSV to your map, and saving this data in a geospatial format. The data we are working with is the location of Antarctic stations and facilities, maintained by COMNAP, accessed from here (but already saved in your data folder for this tutorial).
In order to add these points, go to Layer ➤ Add Layer ➤ Add Delimited Text Layer
2. Click on the 3 little dots, as shown below
3. Navigate to your data folder, select the csv, and click open. The window should now look similar to the below. You will likely need to specify the X and Y field. This is the most important information to set, as it is telling QGIS which fields contain the latitude and longitude coordinates in the csv. X = longitude and Y = latitude. Untick the box for 'DMS coordinates' if ticked, as your coordinates are in Decimal Degrees and not Degrees Minutes Seconds (DMS). Ensure that the Geometry CRS is EPSG 4326 as below.
A lot of people get confused with the 'geometry CRS' when adding data like this. Although the project is in 'WGS84 / Antarctic Polar Stereographic, EPSG 3031', we want to add the data in 'WGS84, EPSG 4326' because the latitude and longitude coordinates in the CSV are geographic degrees in respect of WGS84 datum. They are not in metres, which the Antarctic projection uses.
4. Once you are happy with your parameters, click add and then close the window. You should now have points displayed on your map as shown below! If it hasn't worked, try the steps above again.
5. For simple visualisation, you could keep your points as they are. The points layer in your map is connected to your csv, and if you update that csv, the points in the map will be updated as well, which can be very useful.
6. We often want to save the points into a different vector format though so they can more easily be loaded in other GIS applications. So we will now go through saving them as a geopackage. Right click on the layer in your Layers Panel, click Export and Save Feature As...
7. Select 'geopackage' as the format and then select where to save the new geopackage (in your main data folder for the tutorial). Give the file an appropriate name. You shouldn't need to change anything else in the window. Once your window looks similar to below, click OK.
8. Your new GeoPackage should now be displayed on your map, as well as the original csv. You can remove the CSV, following the same instructions as before (rick click ➤ remove layer).
9. At this stage, save your QGIS project. This is done like any normal software, Project ➤ Save, and save it in the same folder that your data is saved in.
In this section, we will just quickly look at the 'Attribute Table' of your facilities layer, and learn how to identify and select data. As mentioned in the introduction to GIS, most GIS data comes with supplementary information. This is stored in the Attribute Table.
To open this table, right click on the layer in the Layers panel, and select 'Open Attribute Table'.
Have a quick look through the table to see what kind of information is stored here.
This table contains a lot of really useful data that tells you so much more information about the stations, apart from just their location.
In an Attribute Table, each row represents a feature (ie a point/facility) and each column is a 'field'. We will briefly cover editing vector data later on, and during an 'edit session', it is possible to create new features and new fields. The new fields are created in this Attribute table, using the 'New Field' button along the top of the table. Have a quick look at the other buttons on the top ribbon to see what else you can do from here (hover over the buttons to see their names).
The Attribute Table can be extremely useful but we won't do anything else with it for now. Go ahead and close it.
It is possible to 'identify' a feature in your map. To do this, we use the 'Identify Features' tool highlighted in the image below.
Click on the Identify Features button. The 'Identify Results' panel should pop up, as highlighted in the bottom-right in the image below. (If it does not pop up, or you close it by accident, you can make it appear again by right clicking anywhere along the top bar of your project and ticking it on - have a quick look at this even if not needed here, as it is a useful way to turn any panel on or off).
The identify tool works by default on whichever layer you have selected in your Layers panel. Therefore, click on your coastline layer, and then try identifying one of the coastline polygons. The image below shows the Ronne-Filchner Ice Shelf being identified. You can see the attributes appearing in the Identify Results panel, telling you that this polygon has a surface feature of 'ice shelf'.
One final button to introduce in this section is the 'Select Feature' button, found just to the right of the Identify Features button, and shown in the image below. Have a quick go with this button and see what you can select. You can just click on features to select them, or you can drag you mouse to select multiple features. You can also try the other buttons such as 'Select Features by Polygon' and see how this changes your ability to select features. Just spend a minute on this, and then move on to the next section.
To stop identifying or selecting features, click on the 'Pan Map' button which is the white hand. This is the default button to have selected and allows you to just pan around the map as normal.
Adding rasters (grids of pixels/images) is very similar to adding vector data. You should have 2 different rasters in your data folder and we're going to practice adding them in 2 different ways, the same as we did for vectors.
First of all, we will add a Sentinel-1 SAR (synthetic aperture radar) image of the area around the Brunt Ice Shelf. This image is from Polar View and we use images like this primarily for looking at the extent of sea ice, or looking at the growth of rifts and chasms in ice shelves, although in different sectors they have a vast number of applications.
Use your browser panel to navigate to your data folder. Identify the image, named S1A_IW_GRDH_1SSH_20230830T233159_9D2A_S_1.16bit.jp2
.
Drag the image into either your Layer Panel or Map View. It should appear in the correct location. Have a quick look at the image to see if you can recognise a few of the different features in the image, for example the Brunt Ice Shelf, and sea ice.
Finally, we'll add another raster into your project, via the Layers ➤ Add Layer tab, just for good practice. We will be adding a Sentinel-2 optical satellite image this time. The image is an RGB (natural colour) composite. The raw bands were accessed from the Copernicus Open Access Hub, mosaiced into an RGB image, and then a smaller section was cropped from the main image for ease of transfer and download size.
We will add this image using the Layers ➤ Add Layer method which we used for vectors above, but this time select 'Add Raster Layer'. Navigate to your folder and select ''Borgen_S2_RGB.tif. Some other supplementary files will be in your data folder as well, but only worry about the .tif
file.
This file name is not automatic and was assigned manually - Borgen referring to Börgen Bay (location of the image) S2 referring to the satellite name, and RGB referring to the Red Green Blue nature of the image. Useful naming conventions similar to this can be very useful for your own data files. A useful addition to this name would be the date of the image! The date is 2nd Feb 2021, just for information.
Once added, you might not even notice that the image has been added because it covers quite a small area. You can easily find a layer by zooming to it by right clicking on the layer in the Layers Panel, and selecting 'Zoom to Layer', as shown below.
Your image should hopefully look like the screenshot above. Again, have a look around the image by zooming in and out and moving around, and see what you notice. You should be able to see rock outcrop, crevasses, small icebergs in the bays, and Port Lockroy is actually covered in this image as well, if you can spot it!
If you have spare time at the end of this, try downloading your own Sentinel-1 image from Polar View and adding it into QGIS. Rough instructions below:
The blue squares indicate images taken in the last 3 days. Click on one to select it and see a little thumbnail on the left. Choose whichever image you think looks most interesting.
Various access options should appear in the bottom left. Download the 'JPEG2000 file (16 bit)' version by clicking on the green arrow next to this name.
This should download to your computer. Move the image to your data folder and add it into QGIS, or just drag and drop it in straight from your download folder.