Google 地圖平台即將推出新版地圖樣式。新版地圖樣式內建全新的預設調色盤,並且提升地圖體驗、改善服務的可用性。所有地圖樣式都將於 2025 年 3 月自動更新。請參閱「
Google 地圖平台新版地圖樣式」一文,進一步瞭解適用範圍及如何提早啟用。
總覽
您可以透過界線資料導向樣式,使用 Google 多邊形來描繪行政界線、將樣式套用至界線多邊形、在地圖上顯示這些多邊形。
您可以運用界線資料導向樣式,按地點 ID 指定區域,以及將自訂樣式套用至地圖上的界線多邊形。每個地圖項目類型代表一種區域,在設定地圖樣式時,您可以選取要啟用的地圖項目類型。如要查看各國家/地區的邊界涵蓋範圍,請參閱「Google 邊界涵蓋範圍」一文。
地圖項目類型
在資料導向樣式中,Google 會針對代表行政區的地圖項目類型設定邊界。行政區是按機能分類,例如國家/地區、州/省、縣市和郵遞區號。地圖項目類型是按行政層級排列,結構因國家/地區而異。包括:
GMSFeatureTypeCountry
:國家/地區政治實體,通常是最高順位類型。
GMSFeatureTypeAdministrativeAreaLevel1
:國家/地區層級底下的第一順位行政實體。在美國,這類機關等級是州;
GMSFeatureTypeAdministrativeAreaLevel2
:國家/地區層級底下的第二順位行政實體。在美國,這類機關等級是郡。
GMSFeatureTypeLocality
:建制城市或鄉鎮的政治實體。
GMSFeatureTypePostalCode
:國家/地區郵政地址使用的郵遞區號。
GMSFeatureTypeSchoolDistrict
:學區,包含聯合學區、小學和中學。
在地圖上,行政區是以地圖項目圖層的形式顯示,每類行政區都有各自的圖層,地圖項目圖層是按地圖樣式啟用。在 Google Cloud 控制台中設定地圖樣式時,您可以選擇要啟用哪些地圖項目圖層。
設定界線多邊形的樣式
您可以將填滿 (色彩、不透明度) 和筆劃 (色彩、不透明度、筆劃粗細) 的樣式套用至界線多邊形。樣式的用途如下:
- 設定界線多邊形的樣式,或是顯示某個地圖項目類型的所有界線。
- 建立 choropleth 地圖。
Google 邊界涵蓋範圍會顯示地圖項目類型在各個國家/地區是否可用。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-14 (世界標準時間)。
[null,null,["上次更新時間:2025-01-14 (世界標準時間)。"],[[["Data-driven styling enables applying custom styles to Google's administrative boundary polygons on your maps, targeting regions by place ID."],["You can select specific feature types like countries, states, localities, and postal codes to display on your map."],["Boundary polygons can be styled with fill and stroke properties to create visual effects or choropleth maps."],["Google provides boundary data for various countries, and coverage details are available in the documentation."],["Data-driven styling is available across Android, iOS, and JavaScript platforms."]]],["Data-driven styling allows accessing and styling Google's administrative boundary polygons on maps. Users can target regions by place ID and apply custom styling to the polygons. Feature types, categorized by administrative level (e.g., country, state, locality, postal code, school district), are accessed via layers within map styles. Styling options include fill color and opacity, as well as stroke color, opacity, and weight, enabling the creation of choropleth maps or individual boundary styles. Availability of these feature types varies by country.\n"]]