真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

python在openstreetmap地圖上繪制路線圖的實(shí)現(xiàn)-創(chuàng)新互聯(lián)

利用python進(jìn)行經(jīng)緯度軌跡展示

創(chuàng)新互聯(lián)是一家專業(yè)提供溆浦企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、HTML5建站、小程序制作等業(yè)務(wù)。10年已為溆浦眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。

嘿!各位好久不見,距離第一次發(fā)博客已經(jīng)過去兩年多了,本人也從本科生變成了研究生,好了書歸正傳,最近在做一個(gè)關(guān)于航班滑行路徑軌跡的項(xiàng)目,目的是將航班的經(jīng)緯度數(shù)據(jù)在地圖上顯現(xiàn)出來并生成一條路徑,以方便日后的滑行路徑優(yōu)化與分析。本文所用的語言為python,使用的是folium包,數(shù)據(jù)在flightaware網(wǎng)站上可以找到,使用這個(gè)包之前還是需要先進(jìn)行pip install folium

folium的基本用法

  • folium.Map([緯度,經(jīng)度],zoom start,width,height,control_scale,no_touch)   #zoom start為地圖的初始縮放尺寸,數(shù)值越大地圖放大程度就會(huì)越大,width為像素或百分比(int或者str兩種形式),height地圖高度,control_scale為是否需要在地圖上顯示比例尺,默認(rèn)為false,no_touch為是否禁止觸碰地圖或拖拽地圖,默認(rèn)為不禁止。這些功能都是可自己選擇的,一般來說只需要經(jīng)度緯度和zoom_start就好了
  • folium.Marker([緯度,經(jīng)度]).add_to(m)   #在地圖上設(shè)置一個(gè)標(biāo)志符號(hào)
  • folium.PolyLine(location = [[緯度1,經(jīng)度1],[緯度2,經(jīng)度2]...],weight,color,opacity).add_to(m)   #在地圖上劃線將所輸入坐標(biāo)連接起來

python利用folium繪圖代碼

在裝好folium包以后呢,我們就可以使用起來啦,代碼如下所示:

from folium import plugins
import folium
import os
m = folium.Map([39.1289, 117.3539], zoom_start=10) #中心區(qū)域的確定
location =[[39.1289, 117.3539], [39.1277262, 117.3542938], [39.1277275, 117.3543001], [39.1277262, 117.3542938], 
   [39.1277275, 117.3543001], [39.1277262, 117.3542938], [39.1277262, 117.3542938], 
   [39.1271896, 117.3541359], [39.127121, 117.354126], [39.127121, 117.354126], 
   [39.1269348, 117.3541107], [39.1268692, 117.3541061], [39.1263994, 117.3540649], 
   [39.1257591, 117.3540165], [39.125608, 117.3540192], [39.1251984, 117.3539717], 
   [39.1250038, 117.3539568], [39.1246886, 117.3539276], [39.1246033, 117.3539269], 
   [39.1244316, 117.353912], [39.1242828, 117.353912], [39.1241112, 117.3538971], 
   [39.1238623, 117.3538666], [39.1233153, 117.3538361], [39.1232643, 117.3538374], 
   [39.1230354, 117.3537478], [39.1229895, 117.353714], [39.1228638, 117.3535239], [39.122818, 117.3534493], 
   [39.1227334, 117.353241], [39.1226985, 117.3531494], [39.122652, 117.3530273], [39.122652, 117.3529968], 
   [39.1225821, 117.352829], [39.1225239, 117.3526764], [39.1224861, 117.3525835], [39.1224774, 117.3525391], 
   [39.1224657, 117.3525238], [39.1224174, 117.3523745], [39.1221886, 117.3517625], [39.1221771, 117.3517327], 
   [39.1221399, 117.3516388], [39.1221199, 117.3515834], [39.1220169, 117.3512998], [39.1219769, 117.3512115], 
   [39.1219482, 117.3511057], [39.1219188, 117.3510437], [39.121814, 117.3507996], [39.1217791, 117.3507385], 
   [39.1217558, 117.350708], [39.1215935, 117.3505982], [39.121558, 117.3505859], [39.1213417, 117.3506131], 
   [39.1211014, 117.3507475], [39.121011, 117.3507996], [39.1209528, 117.3508301], [39.120883, 117.3508759], 
   [39.1208481, 117.3509064], [39.1207352, 117.3509714], [39.1204834, 117.3511356], [39.120369, 117.3511953], 
   [39.120369, 117.3511953], [39.1202774, 117.351255], [39.1186409, 117.3522551], [39.1185321, 117.3523254], 
   [39.1182976, 117.3524641], [39.1181374, 117.3525686], [39.1173566, 117.3530426], [39.1171188, 117.3531955], 
   [39.1168213, 117.3533746], [39.1163325, 117.3536682], [39.115867, 117.3539581], [39.1156691, 117.3540802], 
   [39.1156342, 117.3540955], [39.1156342, 117.3540955], [39.1144981, 117.3547927], [39.113551, 117.3553772], 
   [39.113551, 117.3553772], [39.1125069, 117.3559869], [39.1120846, 117.3557129], [39.1120846, 117.3557129], 
   [39.1119118, 117.3553002], [39.1118546, 117.355136], [39.111782, 117.3549652], [39.1115456, 117.3542404], 
   [39.1115958, 117.3540649], [39.1115958, 117.3540649], [39.1128411, 117.3532562], [39.1131786, 117.3530426], 
   [39.113807, 117.3526459], [39.113807, 117.3526459], [39.1191902, 117.3493593], [39.1197308, 117.3490295], 
   [39.1206386, 117.3484802], [39.1208713, 117.3483276], [39.1214676, 117.347971], [39.1214676, 117.347971], 
   [39.1214676, 117.347971], [39.1214676, 117.347971]] #輸入坐標(biāo)點(diǎn)(注意)folium包要求坐標(biāo)形式以緯度在前,經(jīng)度在后
route = folium.PolyLine( #polyline方法為將坐標(biāo)用線段形式連接起來
 location, #將坐標(biāo)點(diǎn)連接起來
 weight=3, #線的大小為3
 color='orange', #線的顏色為橙色
 opacity=0.8 #線的透明度
).add_to(m) #將這條線添加到剛才的區(qū)域m內(nèi)
m.save(os.path.join(r'C:\Users\Desktop', 'Heatmap1.html')) #將結(jié)果以HTML形式保存到桌面上

分享題目:python在openstreetmap地圖上繪制路線圖的實(shí)現(xiàn)-創(chuàng)新互聯(lián)
轉(zhuǎn)載來于:http://weahome.cn/article/doicej.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部