GTA 6
把 GTA 6 地圖放上你的網站
把 GTA 6 地圖放進你的攻略、Wiki 或 App。地圖一律從我們的伺服器載入,所以我們做的每項改進都會自動出現在你的地圖上。
- 一分鐘就能嵌入
- 隨時都是最新版
- 自訂標記和圖層
1
嵌入地圖
不用註冊,也不用寫程式。把地圖移到你要的畫面,點地圖加上自己的標記,同意條款後複製程式碼。
你的標記
點地圖新增標記。
最多50個標記,標籤最多80個字。
先同意使用條款,才能取得程式碼。
2
Eggflag Maps API
適合嵌入不夠用的攻略、追蹤工具和 App:可自訂顏色和彈出視窗的標記、用 GeoJSON 畫的區域和路線、把點擊傳回你的頁面,還能選淺色或深色地圖。只要一個 script 標籤,加上你網站的金鑰。
地圖載入失敗。下面的程式碼還是可以用,會顯示整張地圖。
快速上手
<div id="map" style="height:480px"></div>
<script src="https://eggflag.com/sdk/maps/v1.js"></script>
<script>
const map = new Eggflag.Map('#map', {
key: 'efk_…',
game: 'gta-6',
lang: 'zh-hant',
});
map.addMarker({ x: -6924, y: 255, label: 'Capri', color: '#e5484d', text: '1' });
map.addMarker({ x: -7534, y: 4998, label: 'Draper Island', color: '#3e63dd', text: '2' });
map.addMarker({ x: -5621, y: 6875, label: 'Grayson', color: '#30a46c', text: '3' });
map.addLayer({
id: 'zone',
data: { type: 'Polygon', coordinates: [[[-6684, 255], [-6692, 317], [-6716, 375], …]] },
style: { fill: '#e5484d', fillOpacity: 0.18 },
});
map.addLayer({
id: 'route',
data: { type: 'LineString', coordinates: [[-6924, 255], [-7534, 4998], [-5621, 6875]] },
style: { line: '#3e63dd', lineWidth: 3, dashed: true },
});
map.fitBounds();
map.on('click', (e) => console.log(e.x, e.y));
</script>座標單位是遊戲內的公尺:x 往東、y 往北,和我們嵌入連結裡的一樣。點一下地圖就會拿到那個位置的座標。
API 參考
new Eggflag.Map(el, { key, game, lang, center, zoom, theme })- 在你的元素裡建立地圖。key 和 game 為必填;lang、center、zoom 和 theme 可省略。
map.addMarker({ x, y, label, color, text, popup, id })- 新增一個標記。color 格式為 #rrggbb,text 是顯示在標記上的文字,最多3個字元,popup 會在點擊時打開。addMarkers 可以一次傳入整個清單。
map.addLayer({ id, data, style })- 加入以遊戲內公尺為單位的 GeoJSON:區域、路線和點,可用 fill、line 和 circle 樣式。
map.setView({ x, y, zoom }) · map.fitBounds(points?)- 移動地圖,或縮放到剛好容納指定的點(沒有指定就容納所有標記)。
map.on('click' | 'markerclick' | 'layerclick' | 'moveend', fn)- 地圖、標記和圖層上的點擊,以及每次移動結束,都會帶上遊戲內座標。
map.setTheme('light' | 'dark')- 在淺色和深色地圖之間切換。
removeMarker(id) · clearMarkers() · removeLayer(id) · destroy()- 移除標記和圖層,或移除整張地圖。
最多1000個標記、20個圖層,每個圖層最多5000個圖徵。標籤和彈出視窗一律以純文字顯示。
申請金鑰
一個網站一把金鑰。可用於你的網址和它的 www 版本,開發時也能在 localhost 使用。
現在就存起來:金鑰只會顯示一次。用同一個 Email 重新申請,會換成新的金鑰。
這個網站的舊金鑰已經失效。
使用規則
- 允許:在任何網站、攻略、Wiki、直播或 App 上顯示地圖,但只能透過我們的嵌入碼或 Eggflag Maps API。
- 禁止:下載、儲存、爬取、複製、轉存或販售地圖及其圖磚或檔案,描繪或重繪地圖,或用它製作其他地圖或資料集。
- 禁止:用其他任何方式載入地圖或地圖檔案,以及在我們的嵌入碼和 Maps API 提供的功能之外,隱藏、遮蓋或更改地圖框或框內顯示的任何內容。
- 如果違反這些規則,我們會停用金鑰或嵌入。
地圖更新
每次修改都會同步到所有嵌入的地圖,你不用做任何事。
- The map can now be shown on other sites: embed it in a minute or use it with a map key.
- The whole of Leonida as a vector map in the colours of the in-game map: coast, shallows, roads, parks, beaches and buildings.