نقشه برداری حجم دفع زباله (QGIS3)

این آموزش برای کمک به شما در کشف تکنیک های جدید نقشه برداری و ابزارهای نقشه برداری موجود در QGIS طراحی شده است.

بررسی اجمالی کار

شما یاد خواهید گرفت که چگونه داده های نقطه ای از محل های دفن زباله را بگیرید و یک نقشه نمادین متناسب ایجاد کنید که میزان زباله های پردازش شده در هر محل دفن را نشان می دهد.

مهارت های دیگری که یاد خواهید گرفت

  • وارد کردن داده های سرور ArcGIS در QGIS با استفاده از URL REST.

  • وارد کردن داده های جدولی از صفحات گسترده در QGIS.

داده ها را دریافت کنید

می توانید داده های آموزش را از پورتال داده های باز کیپ تاون - https://odp-cctegis.opendata.arcgis.com پیدا کنید. ما داده ها را از پورتال با استفاده از سرویس ArcGIS Online REST وارد خواهیم کرد و سه لایه را که در زیر ذکر شده است آماده خواهیم کرد.

  1. بخش ها: یک شکل فایل چند ضلعی با مرزهای بخش کیپ تاون.

  2. سایت های دفن زباله: یک شکل فایل نقطه ای با امکانات پردازش زباله فعلی، بسته و پیشنهادی در کیپ تاون.

  3. داده‌های دفع زباله: صفحه‌گسترده‌ای با مقدار زباله‌های ورودی به تأسیسات دفع شهر.

بیایید مرحله عاقلانه آماده سازی مجموعه داده را برای این آموزش ببینیم.

  1. به پورتال داده بروید - https://odp-cctegis.opendata.arcgis.com/search?tags=. ما داده های Wards را در نوار جستجو جستجو می کنیم و برای مرور بیشتر کلیک می کنیم.

    ../../_images/db111.png
  2. روی :guilabel:'View Full Details' کلیک کنید تا خدمات موجود برای دریافت داده ها را بررسی کنید.

    ../../_images/db26.png
  3. به پایین بروید تا :guilabel:`View Data Source را باز کنید و روی آن کلیک کنید.

    ../../_images/db32.png
  4. در فهرست خدمات ArcGIS REST، به Home بروید و URL آن صفحه را کپی کنید. کپی شده به نظر می رسد - https://citymaps.capetown.gov.za/agsext1/rest/services.

    ../../_images/db42.png
  5. اکنون QGIS را باز کرده و به :menuselection:`Open Data Source Manager بروید.

    ../../_images/db52.png
  6. لیست منابع داده در پانل سمت چپ مشاهده می شود. برای پیدا کردن ArcGIS REST Server به پایین بروید. برای ایجاد اتصال سرور جدید روی :guilabel:`new کلیک کنید.

    ../../_images/db61.png
  7. در جزئیات اتصال، Name پورتال داده باز کیپ تاون را وارد کنید و آدرس اینترنتی کپی شده را به عنوان ورودی برای URL جای‌گذاری کنید.

    ../../_images/db71.png
  8. روی OK و سپس :guilabel:`Connect کلیک کنید تا پوشه های داده موجود در سرور را ببینید.

    ../../_images/db81.png
  9. Now we will search for all three layers required for the tutorial from the database. Firstly, we will open Wards layer in the QGIS. Expand folders to browse to the layers. Full path to the layer is - Theme_Based ‣ Open_Data_Service ‣ Ward. Select the layer and click Add.

    ../../_images/db91.png
  10. Let's open Landfill sites in QGIS. Full path to the layer is Theme_Based ‣ Open_Data_Service ‣ Landfill Sites And Refuse Transfer Stations. Select the layer and click Add.

    ../../_images/db101.png
  11. Now we will search for the Waste Disposal spreadsheet on the data portal. Click on the Waste Disposal data link to download the file.

    ../../_images/db112.png
  12. The file named Waste Disposal September 2023.ods will be downloaded after clicking on the link. Open the file. The file contains 3 sheets out of which we will be using Disposal_per_Site data for the tutorial.

    ../../_images/db121.png
  13. We will keep only the total disposal per site. Add a new sheet named Disposal_per_Site_edited and copy the data from Disposal_per_Site sheet. Edit the site names by removing the brackets to match the attributes of Landfill sites data. The values are formatted numbers, change it to simple decimals. Save it as waste_disposal_september2023.ods in a data folder for this tutorial.

    ../../_images/db131.png
  14. Observe that there are 3 different sites for Bellville and disposal value is zero for two of them. Let's combine it to keep the only Bellville site with the non-zero value.

    ../../_images/db141.png
  15. Switch to QGIS. We have already imported the shapefiles from ArcGIS server. Let's save it in the local data folder for this tutorial. Right-click on the Landfill Sites And Refuse Transfer Stations layer. Go to Export ‣ Save Features As.

    ../../_images/db151.png
  16. In the Save Vector Layer as dialog, navigate to the data folder and save the shapefile as landfill_sites.shp. Click OK.

    ../../_images/db161.png
  17. Similarly, save the ward layer as wards.shp in the data folder. Now we have prepared the data folder with all three layer and ready to start with the procedure.

    ../../_images/db171.png

For convenience, you may directly download a copy of these files below:

Wards.shp

landfill_sites.shp

waste_disposal_september2023.ods

Procedure

  1. Open QGIS. Click Open Data Source Manager icon to add the layer.

    ../../_images/1143.png
  2. Switch to Vector tab and navigate to the data folder and select wards.shp and landfill_sites.shp files. Click Add.

    ../../_images/2122.png
  3. Open the Attribute Table of the landfill_sites layer. This layer contains all solid waste collection sites in Cape Town. You can see that the STATUS attribute contains whether the facilities are operational or not. We can use the values in this column to select only the Current facilities.

    ../../_images/365.png
  4. Right-click the landfill_sites layer and select Filter.

    ../../_images/433.png

5. In the Query Builder, enter the following expression and click OK. "STATUS" = 'Current'

../../_images/529.png
  1. Once the filter is applied, only a subset of point will be visible on the map. Next we will add the waste_disposal_september2023.ods file. Click on the Open Data Source Manager icon and switch to Vector tab. Navigate the file by clicking on ... button given beside File name. Click Add.

    ../../_images/628.png
  2. In the Select Items to Add dialog, select Disposal_per_Site_edited item and click Add Layers.

    ../../_images/728.png
  3. Open the attribute table of waste_disposal_september2023 layer. This table has the name of the facility and total waste collected at the site for the month of September 2023.

    ../../_images/827.png
  4. Let’s join this table with the landfill_sites points layer. Go to Processing ‣ Toolbox from the menubar.

    ../../_images/928.png
  5. Search and locate the Join attributes by Field Value tool from the toolbox. Double-click to open it.

../../_images/1034.png

11. In the Join Attributes by Field Value dialog, select landfill_sites as the Input layer and NAME as the Table field. Select waste_disposal_september2023 as the Input layer 2 and Disposal Site as the Table field 2. Check the Discard records which could not be joined box. Save the Joined layer by clicking on ... button and select Save to File.

../../_images/1144.png
  1. Name the output layer as waste_by_station_september_2023.shp and click Run.

../../_images/1237.png
  1. Once the processing finishes, a new layer waste_by_station_september_2023 will be added which will have the amount of waste in the Sept2023 column.

../../_images/1335.png
  1. Now let’s visualize this data. First select the Wards layer and click on Open the Layer Styling panel icon.

../../_images/1432.png
  1. Set the symbology of this layer to Single Symbol with a light Fill color and Stroke color.

../../_images/1529.png
  1. Next select the waste_by_station_september_2023 layer and select Simple Marker symbol. Click the drop-down for Symbol layer type.

../../_images/1627.png
  1. Select Filled Marker as the Symbol layer type. We will now change the size of the symbol proportional to the amount of waste collected at the site. To do this, we must apply a Data-defined Override - which can apply a field value or expression to calculate the size for each feature. Click the Data-defined Override button next to Size and select Assistant.

../../_images/1728.png
  1. We want to size the filled symbols based on values of collected waste. Select Sept2023 field as Source. Set values from 5000 to 50000. Now set the size of circle from 1 to 25. Click on the Back icon.

../../_images/1824.png
  1. You will see the circles of different size for each point. The sizes are in Millimeters unit. The data-defined override button will turn yellow indicating that an override is applied for that value.

../../_images/1920.png
  1. Let’s explore more advanced styling options. Change the Symbol layer type to Shapeburst Fill. Select 2 colors of your choice to render the circles with a gradient fill.

../../_images/2018.png

21.Next we will apply a Drop-shadow effect to the circles to make them pop-out on the map. These are known as Live Layer Effects. Scroll down and expand the Layer Rendering section. Check the Draw effects button and click the star button.

../../_images/2123.png
  1. Enable the Drop Shadow option.

../../_images/2220.png
  1. The map looks pretty good now, but the reader needs to know what values these symbols represent. It will be good to have an interpretable legend. Click Back button till you are back in the main Layer Styling dialog. Select Marker and click on the Advanced button at the bottom. Select Data-defined Size Legend.

../../_images/2317.png
  1. Enter Waste Collected (Tonnes) as the Title and click the + button to add legend entries. Since our symbols are scaled by a factor of 3, enter the appropriate value and Label. You will see a nice legend now appear in the Layers panel. The same legend will be available in the Print Layout if you wished to create a map from this data.

../../_images/2417.png
  1. Close the Layer styling panel. The visualization is ready. You learnt how to turn a data in a table to a visually informative and attractive map.

../../_images/2516.png

If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)