نقشه برداری حجم دفع زباله (QGIS3)¶
این آموزش برای کمک به شما در کشف تکنیک های جدید نقشه برداری و ابزارهای نقشه برداری موجود در QGIS طراحی شده است.
بررسی اجمالی کار¶
شما یاد خواهید گرفت که چگونه داده های نقطه ای از محل های دفن زباله را بگیرید و یک نقشه نمادین متناسب ایجاد کنید که میزان زباله های پردازش شده در هر محل دفن را نشان می دهد.
مهارت های دیگری که یاد خواهید گرفت¶
وارد کردن داده های سرور ArcGIS در QGIS با استفاده از URL REST.
وارد کردن داده های جدولی از صفحات گسترده در QGIS.
داده ها را دریافت کنید¶
می توانید داده های آموزش را از پورتال داده های باز کیپ تاون - https://odp-cctegis.opendata.arcgis.com پیدا کنید. ما داده ها را از پورتال با استفاده از سرویس ArcGIS Online REST وارد خواهیم کرد و سه لایه را که در زیر ذکر شده است آماده خواهیم کرد.
بخش ها: یک شکل فایل چند ضلعی با مرزهای بخش کیپ تاون.
سایت های دفن زباله: یک شکل فایل نقطه ای با امکانات پردازش زباله فعلی، بسته و پیشنهادی در کیپ تاون.
دادههای دفع زباله: صفحهگستردهای با مقدار زبالههای ورودی به تأسیسات دفع شهر.
بیایید مرحله عاقلانه آماده سازی مجموعه داده را برای این آموزش ببینیم.
به پورتال داده بروید - https://odp-cctegis.opendata.arcgis.com/search?tags=. ما داده های
Wards
را در نوار جستجو جستجو می کنیم و برای مرور بیشتر کلیک می کنیم.روی :guilabel:'View Full Details' کلیک کنید تا خدمات موجود برای دریافت داده ها را بررسی کنید.
به پایین بروید تا :guilabel:`View Data Source را باز کنید و روی آن کلیک کنید.
در فهرست خدمات ArcGIS REST، به Home بروید و URL آن صفحه را کپی کنید. کپی شده به نظر می رسد - https://citymaps.capetown.gov.za/agsext1/rest/services.
اکنون QGIS را باز کرده و به :menuselection:`Open Data Source Manager بروید.
لیست منابع داده در پانل سمت چپ مشاهده می شود. برای پیدا کردن
کلیک کنید.در جزئیات اتصال، Name
پورتال داده باز کیپ تاون
را وارد کنید و آدرس اینترنتی کپی شده را به عنوان ورودی برای URL جایگذاری کنید.روی OK و سپس :guilabel:`Connect کلیک کنید تا پوشه های داده موجود در سرور را ببینید.
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 - . Select the layer and click Add.Let's open
Landfill sites
in QGIS. Full path to the layer is . Select the layer and click Add.Now we will search for the
Waste Disposal
spreadsheet on the data portal. Click on theWaste Disposal
data link to download the file.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 usingDisposal_per_Site
data for the tutorial.We will keep only the total disposal per site. Add a new sheet named
Disposal_per_Site_edited
and copy the data fromDisposal_per_Site
sheet. Edit the site names by removing the brackets to match the attributes ofLandfill sites
data. The values are formatted numbers, change it to simple decimals. Save it aswaste_disposal_september2023.ods
in a data folder for this tutorial.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 onlyBellville
site with thenon-zero
value.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 .In the Save Vector Layer as dialog, navigate to the data folder and save the shapefile as
landfill_sites.shp
. Click OK.Similarly, save the
ward
layer aswards.shp
in the data folder. Now we have prepared the data folder with all three layer and ready to start with the procedure.
For convenience, you may directly download a copy of these files below:
Procedure¶
Open QGIS. Click
icon to add the layer.Switch to Vector tab and navigate to the data folder and select
wards.shp
andlandfill_sites.shp
files. Click Add.Open the Attribute Table of the
landfill_sites
layer. This layer contains all solid waste collection sites in Cape Town. You can see that theSTATUS
attribute contains whether the facilities are operational or not. We can use the values in this column to select only the Current facilities.Right-click the
landfill_sites
layer and select Filter.
5. In the Query Builder, enter the following expression and click OK.
"STATUS" = 'Current'
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 icon and switch to Vector tab. Navigate the file by clicking on ... button given beside File name. Click Add.In the Select Items to Add dialog, select
Disposal_per_Site_edited
item and click Add Layers.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.Let’s join this table with the
landfill_sites
points layer. Go to from the menubar.Search and locate the Join attributes by Field Value tool from the toolbox. Double-click to open it.
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.
Name the output layer as
waste_by_station_september_2023.shp
and click Run.
Once the processing finishes, a new layer
waste_by_station_september_2023
will be added which will have the amount of waste in theSept2023
column.
Now let’s visualize this data. First select the
Wards
layer and click on icon.
Set the symbology of this layer to Single Symbol with a light Fill color and Stroke color.
Next select the
waste_by_station_september_2023
layer and select Simple Marker symbol. Click the drop-down for Symbol layer type.
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.
We want to size the filled symbols based on values of collected waste. Select
Sept2023
field as Source. Set values from5000
to50000
. Now set the size of circle from1
to25
. Click on the Back icon.
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.
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.
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.
Enable the Drop Shadow option.
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.
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 thePrint Layout
if you wished to create a map from this data.
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.
If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)