跳至主要內容 / Skip to main content
香港GIS探索:QGIS2WEB整合HK GeoTiles
教學

香港GIS探索:QGIS2WEB整合HK GeoTiles

HK GeoTiles約 2 分鐘閱讀93 次閱讀
不懂寫程式也能打造專業的香港互動網頁地圖!結合 QGIS、qgis2web 與 HK GeoTiles 圖磚服務,即可零門檻輕鬆發布。立即探索這套高效流程,將香港歷史變遷與城市數據化為生動的地圖故事。
93

香港GIS探索:QGIS2WEB整合HK GeoTiles

引言

在數位化與資訊快速流動的時代,地理資訊系統(GIS)已不再是少數專家的專利。將生硬的 GIS 數據轉化為大眾可互動的網頁地圖(Web Map),不僅能大幅提升資訊傳遞的效率,更能讓歷史故事與城市數據生動地展現在讀者眼前。

對於許多香港的地理資訊愛好者、歷史學者或社區規劃師而言,編寫複雜的網頁程式碼往往是一大門檻。本文的核心目標,正是帶領讀者打破這道高牆——您完全不需要撰寫任何程式碼,只需透過開源軟體 QGIS 與強大的 qgis2web 套件,再完美整合專為香港打造的 HK GeoTiles 圖磚服務,就能輕鬆打造出具備專業水準的互動式香港地圖。

一、 準備工作:匯入 HK GeoTiles 與在地空間數據

要在網頁上呈現完美的視覺效果,在 QGIS 環境中建立穩固且美觀的地圖基礎是第一步。HK GeoTiles 在香港圖資上具備極高的精準度與豐富的歷史底蘊,是我們最佳的畫布。

1. 認識並介接 HK GeoTiles 基礎底圖

HK GeoTiles 提供了極為豐富的香港專屬地圖資源,無論是清晰的現代街道圖,還是珍貴的香港歷史地圖,都能透過標準的 XYZ Tiles 或 WMS 服務輕鬆介接。在 QGIS 中,您只需在「瀏覽器」面板中的「XYZ Tiles」按右鍵新增連線,輸入 HK GeoTiles 提供的專屬網址,即可將高畫質、載入速度極快的香港圖磚無縫載入為底圖,為您的專案奠定堅實基礎。

2. 準備香港在地向量圖層 (Vector Data)

底圖準備好後,接下來是加入您的專屬數據。您可以匯入與香港相關的點、線、面資料(Vector Data)。例如:標示中西區古蹟分佈的「點」圖層、描繪不同年代維多利亞港海岸線變遷的「線」圖層,或是區議會選區邊界的「面」圖層。這些向量數據將是後續網頁地圖中,使用者進行互動的核心內容。

3. 符號化與視覺設計 (Symbology)

請記住一個重要原則:QGIS 中的圖層樣式會直接反映在最終的網頁地圖上。因此,在 QGIS 內進行符號化(Symbology)至關重要。建議根據 HK GeoTiles 的底圖色調來調整您的向量圖層。例如,若使用色彩較豐富的現代底圖,向量符號可選擇對比強烈的鮮黃或亮紅色;若使用泛黃的歷史底圖,則可搭配復古色系的標籤與邊界線,確保地圖兼具高度可讀性與視覺美感。

二、 核心教學:使用 QGIS2WEB 轉換網頁地圖

當 QGIS 內的圖層與樣式都設定妥當後,我們就進入技術核心,透過 qgis2web 將靜態專案一鍵轉換為網頁地圖。

1. 安裝 qgis2web 擴充套件

在 QGIS 頂部選單中點擊「附加元件」>「管理與安裝附加元件」,在搜尋列中輸入 qgis2web。找到該套件後點擊安裝。安裝完成後,您的工具列上會出現一個網頁與放大鏡結合的小圖示,這就是我們通往 Web GIS 世界的鑰匙。

2. 選擇合適的 Web 框架 (Leaflet vs. OpenLayers)

點開 qgis2web 後,系統會讓您選擇匯出的底層網頁框架,主流為 Leaflet 與 OpenLayers。對於一般香港歷史地圖展示、社區考察或基礎 GIS 應用,我們強烈推薦選擇 Leaflet。Leaflet 以輕量、載入速度快且對行動裝置極度友善著稱,非常適合搭配 HK GeoTiles 進行流暢的圖磚渲染。

3. 基礎參數與視角設定

在 qgis2web 的設定面板中,您可以精準控制地圖的呈現方式。請務必設定合適的「初始縮放級別 (Zoom level)」與「地圖範圍 (Extent)」。您可以設定為「Match project canvas extent」,這樣網頁地圖一打開,就會精準聚焦在您於 QGIS 中設定好的香港全境,或是特定的關注社區(如深水埗或西營盤),給予使用者最佳的第一印象。

三、 提升互動體驗:圖層控制與資訊視窗

一個優秀的網頁地圖不僅僅是好看,更要能「說故事」。透過 qgis2web,我們可以輕鬆加入各種互動元素。

1. 設定資訊彈出視窗 (Pop-ups)

在「Layers and Groups」設定分頁中,您可以為每一個向量圖層啟用 Pop-ups。當網頁使用者點擊香港地標時,視窗會彈出背後的屬性資料。您可以自訂要顯示的欄位,例如隱藏繁雜的 ID 碼,只顯示「建築年份」、「歷史照片連結」或「該區人口數據」,讓地圖成為一個豐富的資訊載體。

2. 啟用圖層控制 (Layer Control)

這項功能對於歷史地圖應用至關重要!在「Appearance」分頁勾選加入 Layer Control,網頁右上角就會出現一個圖層選單。想像一下,使用者可以在選單中自由切換 HK GeoTiles 提供的 1904 年歷史底圖與現代街道圖,親眼見證百年來維港海岸線的填海造地變遷,這種對比體驗是非常震撼的。

3. 加入實用的小工具 (Widgets)

為了進一步提升實用性,您可以在設定中勾選加入「測量工具 (Measure tool)」讓使用者測量街道距離;加入「定位按鈕 (Geolocate user)」讓拿著手機在香港街頭實地考察的讀者能看見自己的位置;或是加入「搜尋列 (Search bar)」,方便使用者快速尋找特定的香港街道或大廈。

四、 成果發布與香港 GIS 應用場景

完成所有設定並預覽無誤後,最後一步就是將您的心血結晶發布到網路上與世界分享。

1. 匯出檔案與本機測試

點擊「Export」後,qgis2web 會自動生成一個包含 HTML、CSS 與 JavaScript 的資料夾。這是一個完整的靜態網頁包。您可以直接在電腦上點擊 index.html,透過瀏覽器進行本機測試,確認 HK GeoTiles 的圖磚載入順暢,且各項互動功能皆正常運作。

2. 免費網頁代管服務推薦

對於非程式開發背景的讀者,完全不需要花錢租用伺服器。您可以使用 GitHub Pages 或 Vercel 這類免費的靜態網頁代管服務。只需將 qgis2web 匯出的資料夾上傳,幾個簡單的步驟後,您就能獲得一串專屬網址,隨時隨地透過 WhatsApp 或社交媒體與同好分享您的香港地圖。

3. 結合 HK GeoTiles 的實務應用案例

這套「QGIS + qgis2web + HK GeoTiles」的技術組合在香港擁有無限潛力。歷史學者可以製作「中環開埠初期歷史考察路線圖」;城市規劃師能展示「新界北區未來發展與現狀對比圖」;社區工作者則能繪製「無障礙設施與長者友善空間分佈圖」。高品質的本地圖磚加上互動技術,能讓生硬的數據轉化為推動社會進步的視覺力量。

結論

透過本文的教學,相信您已經體會到 QGIS、qgis2web 與 HK GeoTiles 三者結合的強大威力。這套工作流程具備低門檻、高靈活度的特性,且因為使用了專為本地打造的 HK GeoTiles 服務,讓您的地圖極具在地價值與精準度。

心動不如馬上行動!現在就去申請並使用 HK GeoTiles 的圖磚服務,打開您的 QGIS,動手製作第一張專屬的香港互動式網頁地圖吧!我們非常期待看到您的創意,歡迎在下方留言區或各大社群平台分享您的地圖作品,一起探索香港 GIS 的無限可能!

EN

English Summary

The evolution of Geographic Information Systems (GIS) has steadily shifted the focus from static desktop software to interactive web-based mapping, transforming how spatial narratives and urban data are communicated to the public. However, for many historians, urban planners, and spatial data enthusiasts, the technical barrier of writing complex web code—such as HTML, CSS, and JavaScript—has historically hindered the creation of custom web maps. To bridge this gap, a streamlined, no-code workflow has emerged, empowering users to build professional-grade interactive maps of Hong Kong. By combining the robust open-source capabilities of QGIS, the intuitive qgis2web plugin, and the highly specialized spatial resources of the HK GeoTiles service, creators can bypass traditional programming hurdles. This integration democratizes web mapping, allowing international and local researchers alike to seamlessly translate raw geographic data into engaging, accessible digital experiences without requiring advanced developer skills.

The technical foundation of this workflow begins within the QGIS desktop environment, where users prepare their spatial data and design the visual hierarchy of their maps. After establishing the base map, creators can import customized vector layers, such as points representing colonial-era heritage sites, lines delineating historical coastline shifts, or polygons outlining modern electoral districts. Since the visual styling in QGIS directly dictates the final web map's appearance, careful attention to symbology is emphasized to ensure high readability and aesthetic alignment. Once the static map is prepared, the qgis2web plugin facilitates a one-click conversion into a fully functional web interface. For projects focused on urban exploration or historical analysis, the Leaflet framework is highly recommended during the export process. Leaflet’s lightweight architecture and mobile responsiveness ensure that the resulting maps load quickly and function smoothly on various devices, making it an ideal choice for rendering complex spatial projects for a broad audience.

At the heart of this mapping ecosystem is HK GeoTiles, a dedicated map tile service that provides the essential geographic canvas for these projects. Offering a rich repository of both high-resolution modern street plans and meticulously digitized historical maps of Hong Kong, HK GeoTiles can be effortlessly integrated into QGIS via standard XYZ or WMS connections. The true power of this service is unlocked when paired with the interactive features generated by qgis2web. For instance, users can enable layer control widgets that allow the public to seamlessly toggle between a 1904 historical HK GeoTiles base map and a contemporary street view. This specific functionality provides a visually striking method to explore Hong Kong’s extensive land reclamation history, particularly around Victoria Harbour. Furthermore, creators can embed dynamic pop-up windows linked to vector data, revealing underlying attributes such as building construction years or historical photographs, alongside practical tools like geolocation and distance measurement for on-the-ground field research.

The practical implications of this integrated approach are profound for GIS professionals, community planners, and historians who wish to publish their spatial findings globally. Upon exporting the project via qgis2web, users receive a complete, self-contained package of static web files that requires no complex backend server infrastructure to maintain. These files can be hosted entirely for free on platforms like GitHub Pages or Vercel, allowing researchers to instantly share their interactive Hong Kong maps across social media or professional networks. This low-barrier, high-flexibility methodology enables rapid prototyping for a variety of localized applications, from mapping early colonial settlement routes in Central to analyzing future urban development in the New Territories. Ultimately, leveraging the localized precision of HK GeoTiles alongside accessible open-source web mapping tools equips enthusiasts and professionals with everything they need to transform static historical data into compelling, publicly accessible spatial narratives.

QGIS2WEb
QGIS
HKGeotiles
香港圖磚
93
H

HK GeoTiles

HK GeoTiles 撰稿人

致力於整理及分享香港歷史地圖磚資源,讓公眾更容易取用珍貴的地理資訊。

載入附件中…

相關文章

查看全部