跳至主要內容 / Skip to main content
一文看懂GeoJSON上載:以香港法定古樹為例的地圖教學
tutorial

一文看懂GeoJSON上載:以香港法定古樹為例的地圖教學

HK GeoTiles約 1 分鐘閱讀61 次閱讀
本教學介紹 GeoJSON 格式及如何在 HK GeoTiles 上載自訂圖層,附法定古樹示範資料。
61

什麼是 GeoJSON?

GeoJSON 聽起來很專業,但其實它就是一種用來記錄「地理位置」的開放格式。你可以把它想像成一份數碼地圖清單,裡面可以儲存地圖上的點(例如一棵樹的位置)、線(例如一條行山徑),或是多邊形(例如一個公園的範圍),還能順便記錄它們的名字、地址和分類等實用資訊。

最棒的是,GeoJSON 是純文字格式,任何文字編輯器都能輕鬆打開。不管是專業的 GIS 軟件(如 QGIS、ArcGIS),還是我們常用的網頁地圖工具(如 Leaflet、OpenLayers、Mapbox),都能完美支援它!


如何下載香港政府 GeoJSON 資料

想自己動手玩玩看嗎?其實香港政府在多個開放數據平台上,都免費提供了豐富的地圖資料。以下教你幾個輕鬆尋寶的方法:

1. 資料一線通(data.gov.hk)

這是最常用的政府數據庫,找資料非常方便:

  • 進入 https://data.gov.hk 網站。

  • 在搜尋欄輸入你有興趣的關鍵字,例如「古樹」、「法定古樹」或「樹木」。

  • 將資料格式篩選為 GeoJSON

  • 找到想要的資料後,點擊「下載」,就能把 .geojson 檔案存到電腦裡囉!
  • 法定古樹

    2. 香港地圖服務(CSDI Portal)

    如果你需要更專業的地圖圖層,可以來這裡:

  • 進入 https://portal.csdi.gov.hk。

  • 直接搜尋你想找的圖層名稱,像是「Statutory Trees」。

  • 選擇以 GeoJSON 格式下載即可。
  • 3. 發展局樹木辦事處

    順帶一提,如果你對剛才提到的「法定古樹」特別有興趣,這些資料是由發展局樹木辦事處管理的。你只要在「資料一線通」搜尋「法定古樹名冊」,就能隨時掌握最新動態!


    在 HK GeoTiles 地圖上載 GeoJSON
    在 HK GeoTiles 地圖上載 GeoJSON

    在 HK GeoTiles 地圖上載 GeoJSON

    拿到了地圖檔案,接下來怎麼把它顯示出來呢?在 HK GeoTiles 網站上,把資料放進地圖簡直易如反掌。你可以選擇以下兩種超簡單的方法:

    方法一:拖放上載

    這絕對是最快捷的方式:

  • 首先打開 HK GeoTiles 地圖:https://hkgeotiles.com/map。

  • 把剛剛下載的 .geojson 檔案,直接拖放進地圖畫面裡。

  • 大功告成!圖層會瞬間出現在地圖上,畫面還會自動縮放到剛好能看見所有資料的範圍。
  • 方法二:使用面板上載按鈕

    如果你習慣點擊操作,也可以跟著這樣做:

  • 在地圖畫面右側找到圖層面板,往下滑到「自訂圖層 Custom Layers」區塊。

  • 點擊右上角的 + 符號。

  • 從電腦裡選取你的 .geojson 檔案。

  • 圖層馬上就會載入並顯示在地圖上啦!

  • 使用自訂圖層功能

    成功載入資料後,你會發現圖層面板多了一些新資訊,讓我們來看看這些小工具代表什麼:

    • 彩色方塊:代表這個圖層的顏色(系統很聰明,會為每個圖層自動分配不同的顏色)。
    • 幾何圖示:告訴你這是哪種形狀的資料(● 代表點、╌ 代表線、▬ 代表多邊形)。
    • 要素數量:括號裡的數字就是資料的總筆數。
    • 👁 顯示/隱藏:點擊它可以隨時切換圖層的顯示狀態。
    • 縮放按鈕:只要點一下圖層名稱,地圖就會自動飛到這筆資料的所在範圍。
    • 🗑 刪除:不需要這個圖層了嗎?點這裡就能輕鬆移除。

    查看要素屬性

    想知道更詳細的資訊嗎?只要在地圖上點擊任何一個 GeoJSON 標記,就會彈出一個資訊小視窗。裡面會詳細列出這筆資料的所有屬性,例如樹木的名字、地址、保護狀態等等,一目了然!


    試試看:下載法定古樹示範資料

    光看文字不過癮?我們已經幫你準備好了一份香港發展局的「法定古樹」GeoJSON 示範檔案。你可以直接點擊下方下載,親自體驗一下:

    下載完成後,馬上打開 https://hkgeotiles.com/map,試試看把檔案拖進地圖裡吧!你馬上就能看到全香港法定古樹的精確分佈位置,非常有趣!


    注意事項

    在開始你的地圖探索之旅前,最後提醒幾個小細節:

    • HK GeoTiles 完美支援 .geojson 以及 .json 格式檔案。
    • 你的圖層資料會安全地儲存在瀏覽器的本地空間(IndexedDB)裡。就算不小心重新整理頁面,資料也會自動還原,不用擔心不見!
    • 如果你上載的是比較大的 GeoJSON 檔案(超過 10 MB),系統可能會需要一點時間處理,請耐心等候一下。
    • 玩膩了想清空畫面?只要點擊面板上的 🗑 垃圾桶圖示,就能把圖層移除囉。
    EN

    English Summary

    GeoJSON has emerged as a fundamental open-standard format in the geospatial industry, allowing users to efficiently record and share geographical features such as points, lines, and polygons alongside rich attribute data. Because it relies on a lightweight, text-based structure, GeoJSON is universally supported by professional Geographic Information System applications like QGIS and ArcGIS, as well as web mapping libraries such as Leaflet and Mapbox. In the context of Hong Kong, the government has increasingly made valuable spatial datasets available to the public through robust open data platforms. Researchers, historians, and geospatial enthusiasts can access a wealth of information via the DATA.GOV.HK database or the Common Spatial Data Infrastructure Portal. One prominent example of this accessible spatial data is the registry of Old and Valuable Trees, managed by the Greening, Landscape and Tree Management Section of the Development Bureau. This dataset not only highlights the city's ecological heritage but also serves as an excellent starting point for those looking to explore urban historical geography through modern mapping technologies.

    Acquiring this spatial data is a straightforward process that empowers international researchers to examine Hong Kong's landscape without needing local, proprietary software. By navigating to Hong Kong's primary open data portals, users can search for specific historical or environmental keywords, such as statutory trees, and filter the results specifically for the GeoJSON format. Downloading these files provides users with a comprehensive digital ledger of the city’s protected trees, detailing exact coordinate locations alongside crucial metadata like tree species, historical significance, and preservation status. For historians and urban researchers, mapping these natural monuments offers unique insights into Hong Kong’s urban development, revealing how historical conservation efforts intersect with rapid modern city planning. The accessibility of this data in a universal format bridges the gap between raw government archives and interactive, analytical mapping, allowing international scholars to study Hong Kong's spatial heritage remotely.

    The HK GeoTiles platform significantly simplifies the process of visualising these historical and environmental datasets by offering an intuitive, browser-based mapping interface. Users can seamlessly integrate their downloaded GeoJSON files into the HK GeoTiles map using a highly accessible drag-and-drop function, which instantly renders the spatial data and automatically adjusts the map's zoom level to frame the newly added features perfectly. Alternatively, the platform provides a dedicated custom layer management panel where users can manually upload their files. Once the data is loaded, HK GeoTiles automatically assigns distinct colours to differentiate layers and displays clear indicators for geometry types and feature counts. The platform enhances user interaction by allowing individuals to click on any rendered data point, which triggers a detailed information window displaying all associated metadata, such as the specific address and conservation status of a statutory tree. This seamless integration ensures that users can focus on spatial analysis and historical exploration rather than struggling with complex data processing.

    For international Geographic Information System professionals and history enthusiasts, the practical takeaways of using HK GeoTiles extend beyond simple visualisation to include robust, user-friendly data management. The platform is engineered to handle both standard GeoJSON and JSON formats efficiently, and it employs local browser storage technologies to ensure that custom layers persist even if the web page is accidentally refreshed or closed. While exceptionally large datasets exceeding ten megabytes may require a brief processing period, the overall experience remains highly responsive and eliminates the need for complex database configurations. Users maintain complete control over their workspace, equipped with straightforward tools to toggle layer visibility, zoom to specific spatial extents, or clear the map entirely when beginning a new project. By lowering the technical barriers to entry, HK GeoTiles empowers researchers globally to overlay rich thematic datasets onto historical map tiles, fostering a deeper understanding of Hong Kong's dynamic spatial history and providing a powerful tool for visual storytelling and academic research.

    GeoJSON
    教學
    法定古樹
    開放數據
    地圖
    61
    H

    HK GeoTiles

    HK GeoTiles 撰稿人

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

    載入附件中…

    相關文章

    查看全部