在前面的文章有介紹過如何在QGIS中設定顯示文字,這一次則是要分享除了選定欄位以外,也可以設定為符合特定條件的圖徵才會顯示文字(Rule-based labeling)。範例一樣是康世美的分店資料,但這次我們只顯示在台北的康是美門市店名。
一、打開Labels功能,並選擇Rule-based labeling

二、點選下方的”+”符號新增一個規則

二、新增規則的條件設定(Expression)
在Edit Rule對話視窗中,找到Filter,按下旁邊的符號來新增規則的條件設定。按下後會打開Expression String Builder。

三、設定規則的條件設定(Expression)
這邊以只顯示在台北的康是美門市店名為例,所以查詢條件中輸入:
"COUNTYNAME" = '臺北市'

四、選擇顯示文字的欄位
最後,一樣要記得選擇用哪個欄位當作顯示的文字。
- 將Label打勾
- 在Label with 選擇name (店名)

五、Rule-based labelingLabels設定成果
設定完成後,可以看到只有在台北市的門市的點位上都會顯示門市名稱。

小額支持鍾肯尼
如果我的文章有幫助到你,歡迎你點這裡開啟只要40元的小額贊助連結,可以贊助我一杯咖啡錢;我會更有動力繼續寫作,幫助大家解決更多問題。