接入高德地圖
- 登錄高德開放平臺
- 創建應用
- 添加key
- 創建靜態地圖
- 文檔說明
- markers
- 網頁應用
- 總結
登錄高德開放平臺
高德開放平臺
創建應用
點擊我的應用 -> 創建應用
添加key
調相關接口都需要用到這個key!
創建靜態地圖
靜態地圖API文檔
文檔說明
服務地址
URL | 請求方式 |
---|---|
https://restapi.amap.com/v3/staticmap?parameters | GET |
請求參數
例如:https://restapi.amap.com/v3/staticmap?location=120.01746,30.281423&zoom=12&size=750*300&markers=mid,,A:120.01746,30.281423&key=你的key
高德坐標拾取器
markers
markers=markersStyle1:location1;location2..|markersStyle2:location3;location4..|markersStyleN:locationN;locationM..
marersStyle(參數名稱) | 說明 | 默認值 |
---|---|---|
size | 可選值: small,mid,large | small |
color | 選值范圍:[0x000000, 0xffffff] | 0xFC6054 |
label | [0-9]、[A-Z]、[單個中文字] 當 size 為 small 時,圖片不展現標注名。 | 無 |
markers這個參數要注意格式,冒號后面的跟的是你要標記的坐標,location只的是以該坐標為中心繪制地圖
網頁應用
直接放到 img標簽中就行
<img src="https://restapi.amap.com/v3/staticmap?location=120.01746,30.281423&zoom=12&size=750*300&markers=mid,,A:120.01746,30.281423&key=你的key" alt="" srcset="">
總結
- 高德開放平臺
- api參數配置
接入高德地圖靜態地圖與普通的地圖截圖區別在于瀏覽器向高德地圖請求最新的地圖
。
我現在可以上岸了嗎?
上岸!