We are going to step through an example to show you how to convert the raster tiles you have been provided into a raster.
The raster data
In this example, we are looking at a sample of 56 tiles of tree raster. The metadata is shown in the table below:
|
Data type | AI Raster |
---|
File format | GeoTIFF |
---|
Horizontal spatial reference | WGS 84 / UTM zone 56S (EPGS:32756) (Epoch: Aug. 2020) |
---|
Number of export parts | 1 |
---|
Tile size | 1.35 km x 1.35 km |
---|
Number of tiles | 11 x 9 (56 non-empty tiles) |
---|
Data extent | X: 306,827.34 -321,155.85 (14.33 km) Y: 6,248,495.08 -6,259,787.57 (11.29 km) |
---|
Data area | 71.56 km2 |
---|
Capture date(s) | 01 Aug 2020 - 03 Aug 2020 |
---|
Export date | 02 Oct 2020 |
---|
Reference | AIOD-30_CumberlandCouncil/AIRasterGeoTIFF |
---|
Each pixel shows the confidence score rated between 0-255 and the pixel size is 0.075m GSD.
There are 56 tiles of each raster:
- AIRaster_8-MediumAndHighVegetation *
- AIRaster_9-LowVegetation0.5m-2m
* In this example, we are working only with the AIRaster_8-MediumAndHighVegetation tiles, but the process will be the same for the other dataset as well.
In this example, we are only interested in pixels representing vegetation with greater than 50% confidence. As we are using JPEG compression, confidence is represented from 0 to 255 (0% to 100% confidence).
Step 1 – Bring the tiles into QGIS
Open QGIS and open a new map.
Drag and drop the AIRaster_8-MediumAndHighVegetation onto the mapping frame.
Step 2a – Convert to a virtual raster
This combines all the tiles into one raster.
Step 2b - Add all the raster tiles to the virtual raster tool
- Open the window as shown below, and click Select All and then OK.
- Select “Highest” from the Resolution drop down.
- Turn Off “Place each input file into a separate band”.
- Click Run.
This runs the Virtual Raster tool, and you will have a temporary file that is a combination of all the raster tiles you were supplied. - Click Close.
Step 3 – Downsample the raster
The raster that we provide is very high resolution 7.5cm/pixel GSD. Many computers won't be able to handle this level of detail as the files end up being too large.
To get around this, we need to downsample the raster. From the Raster menu, select Align Rasters.
- Add the Virtual Raster to the tool using the green plus button.
- Select Virtual from the Input raster layer drop down.
- Select a location to save the output and give it a name and accept the standard resampling method.
- Click OK.
Check the Cell Size box and set both horizontal and vertical to 0.30m. This speeds up the process without much loss of granularity.
- Click OK.
- Click Close.
NOTE: Make sure you click Close, not OK, otherwise it will re-run.
Step 4 – Convert the raster to binary using the Raster Calculator
- From the Raster menu, select Raster Calculator.
- Select your Raster layer (double click to add to expression).
- Select where you want to save the output Raster and give it a name.
- Create your expression >= 128 will get all of the pixels that are at, or above 128/256 confidence. (This equates to 50% confidence.)
- Click OK.
Step 5 – Convert to vector
To do this you will need to access the processing toolbox.
If it is not already visible, right click on the panel and turn on Processing toolbox panel.
In the processing toolbox panel, search for Vectorizing, and select Vectorising grid classes.
- Select the raster that you created in step 3.
- Select “[0] one single class specified by class identifier”.
- Set the Class Identifier value as “1”.
- Select “[0] one single (multi-)polygon object”.
Alternatively, if you want each piece of vegetation as output as many single polygons, select "[1] each island as separated polygon". - Select the location you want to save the output.
- Click Run.
You might see a "not responding" message, but the process should continue and complete the output. It may take several minutes, depending on the size. Once it is complete, the processing window closes. Close the Vectorising window.
You should now have a shapefile of the trees!