Difference between revisions of "Calculating historical agricultural land differences using QGIS"
(→Data) |
|||
Line 8: | Line 8: | ||
==Data== |
==Data== |
||
+ | Two files are needed for thhis project, the 1983 Agricultural Resource Inventory, and the most current Agricultural Resource Inventory. The source is constantly being updated, so I have provided a link to the homepage of each file, rather than a direct download link. Once on the page, select 'open', and the data will begin downloading. |
||
− | The data used in this tutorial can be downloaded from OMAFRA. Follow the hyperlink here. |
||
+ | |||
+ | For the 1983 data, please visit: https://geohub.lio.gov.on.ca/datasets/agricultural-resource-inventory-1983 |
||
+ | For the current data, please visit: https://geohub.lio.gov.on.ca/datasets/agricultural-resource-inventory-final |
||
==Tutorial Instructions== |
==Tutorial Instructions== |
Revision as of 18:49, 20 December 2019
Contents
Introduction
One issue when working with large sized data sets is the massive resources required to render the files. This is not so bad when you have a computer powerful enough to handle it, or you absolutely need to have data that detailed, but it is when you do not. I found myself in that situation about a year ago. I was attempting to graphically represent agricultural land attrition in Southern Ontario, from 1983 – 2017. The data I had downloaded was incredibly detailed, perfect for if you wanted to grab a subset and analyze it on a micro level. Not so great when you are trying to analyze on a macro level. While I was able to complete my analysis, it was frustratingly time consuming. Every map movement caused a render lag, and any use of analysis tools resulted in a long wait. This leads me to now. While I was not able to think up a way to do it back then, I figured now might be the time to try. This lead me to a feature in QGIS called ‘dissolve’. While it is also available in ArcPro, that is not the purpose of this assignment. I decided to see if I recreate my project, using QGIS instead of Arc, and perhaps improve upon it a little.
Data
Two files are needed for thhis project, the 1983 Agricultural Resource Inventory, and the most current Agricultural Resource Inventory. The source is constantly being updated, so I have provided a link to the homepage of each file, rather than a direct download link. Once on the page, select 'open', and the data will begin downloading.
For the 1983 data, please visit: https://geohub.lio.gov.on.ca/datasets/agricultural-resource-inventory-1983 For the current data, please visit: https://geohub.lio.gov.on.ca/datasets/agricultural-resource-inventory-final
Tutorial Instructions
Step 1: Identifying the Problem
In this image we can see the problem. The data is so dense that changes between the two cannot be seen. This data is really meant for querying, not so much for display. [[File:[1] problem.jpg|1000px]]
Looking at this, it isn’t hard to see why we’re having the difficulties we are. There are 555,000 individual features in six fields, in the 2017 data, alone. We need to pare that down. All we want to keep is the ‘Shape_area’, which is in hectares. This will allow us to calculate a final area. [[File:[2] attributes.jpg|1000px]]
Step 2: Deleting Fields
By deleting unnecessary fields, we can hopefully reduce the size and complexity of the data.
[[File:[6] delete_field.jpg|1000px]] Ensure that the editing tool is toggled on (highlighted in red), then open the new files attribute table, and delete the unnecessary fields.
[[File:[7] delete_field_scrn.jpg|1000px]] Everything except ‘Shape_Area’ should be removed. This can take a while. Once completed, save layer edits by selecting the icon on the right of the editing tool. Editing can be toggled off at this point as well.
Step 3: Check Data Validity
This is a very important step. Unlike ArcGIS, if there is any errors or invalid data, QGIS will quit whatever process is running.
Now that we have deleted all unnecessary fields, we need to be sure that there are no errors in our shapefile geometry. To do this, we need to use the Check Validity tool.
[[File:[3] chk_val_nav.jpg|1000px]] Navigate to the check validity tool.
This is the first step. If there are errors in the data, or some of it is invalid, QGIS will not be able to process it. The ‘Check Validity’ tool will allow us to remove any bad data, and ensure that processing proceeds smoothly.
[[File:[4] chk_val.jpg|1000px]] Select the file, and leave all options as default.
[[File:[8] save_val.jpg|1000px]] Once the validity checker has completed its operation, there should be three files. Valid output, Invalid output, and error. Remove the invalid and error, then right click on Valid_output and select Make Permanent…
[[File:[9] new_files|1000px]] When the new file has been saved, remove Valid_output, as well as the old ARI_2017 file, and open the newly created file from where you have saved it. You should wind up with something like this. You may not see the new file in the QGIS browser. If this happens, simply hit the refresh button. Be sure to duplicate this process for ARI_1983.
Step 4: Dissolve
The dissolve tool will allow us to merge all the individual polygons into one. This should make it much less resource intensive to render the data. It will also merge the area for each polygon into one attribute. This will make it easy to compare with the field calculator later on.
[[File:[8] dissolve_nav.jpg|1000px]] Once completed, we can then finish the processing by dissolving the individual breaks, and creating a seamless surface.
File[[:[9] dissolve.jpg|1000px]] Open the dissolve tool, ensure ARI_2017_chk is selected, and run the tool. All defaults should remain the same. This will take a while.
Step 5: Field Calculator
Now that processing is complete, we can calculate the difference between the files. This will give us a number, that can then be converted into % change.
Step 6: Difference
This allows us to generate a shapefile of the differences between two files, making it extremely easy to visually represent what has changed.
References
- ↑ 1 The European Space Agency,"Sentinel-2", Retrieved: 2019-11-05