全球Map分割地理坐标的多帧- Python

plicqrtu  于 2023-01-10  发布在  Python
关注(0)|答案(1)|浏览(139)

我尝试在python中使用folium在Map上绘制路线。它在最终结果中分割坐标。我想在一帧中连续绘制它们。下面是我使用的python代码。

import folium
import numpy as np

waypoint_lat = [46.18143,41.181091,41.116669,41.106354,41.096893,41.088089,41.079468,41.07132,41.066666,41.65184,42.302689,42.932678,43.538879,44.118713,44.350006,44.566467,44.795288,45.021225,45.228516,45.441422,45.672607,45.899078,46.085281,46.249039,46.4021,46.541992,46.667572,46.780228,46.886292,46.985153,47.077133,47.166321,47.252747,47.335037,47.4104,47.479202,47.539337,47.589584,47.629623,47.658722,47.676178,47.681091,47.672974,47.651947,47.618027,47.571045,47.516556,47.451935,47.37735,47.291672,47.194977,47.087677,46.972733,46.847122,46.711166,46.567368,46.41391,46.253204,46.082031,45.901016,45.710999,45.510651,45.302277,45.081284,44.849564,44.6017,44.345261,44.085999,43.816605,43.531265,43.245621,42.949341,42.635452,42.3078,41.976959,41.637436,41.282333,40.91713,40.541733,40.158661,39.764236,39.36058,38.950378,38.531982,38.10463,37.670044,37.22699,36.768356,36.287155,35.790436,35.306839,34.832123,34.355316,33.886368,33.633331,33.062317,32.48587,31.900589,31.302673,30.687531,30.07962,30.066666,29.484695,28.896545,28.311295,27.724777,27.136093,26.538879,25.937531,25.336563,24.732254,24.129868,23.524063,22.919983,22.314301,21.705246,21.096741,20.487854,20.100006,19.558319,19.449997,18.789169,18.129257,17.475418,16.82338,16.166107,15.51886,14.872589,14.22435,13.566574,12.905838,12.243958,11.579559,10.912247,10.243134,9.568069,8.888062,8.201279,7.639999,7.1884,6.432449,5.686813,4.948334,4.266663,3.409943,2.639999,1.717728,1.5,1.416672,1.316666,1.293335,1.278336,1.261673,1.21051,1.185333,1.173126,1.138107]
waypoint_lon = [-135.63028, -131.869141, -131.916672, -132.936081, -133.873093, -134.743637, -135.597321, -136.405945, -136.883331, -137.526886, -138.242645, -138.948761, -139.629333, -140.298294, -140.566666, -141.428207, -142.375839, -143.353027, -144.290405, -145.299164, -146.45517, -147.659042, -148.711578, -149.692413, -150.66423, -151.607285, -152.506775, -153.364441, -154.224182, -155.080688, -155.935669, -156.830948, -157.777847, -158.774689, -159.799591, -160.870987, -161.971848, -163.091309, -164.236511, -165.407211, -166.606674, -167.825409, -169.055115, -170.274704, -171.492157, -172.712128, -173.829758, -174.933807, -176.02684, -177.125153, -178.225937, -179.323364, 179.608582, 178.539032, 177.471298, 176.423508, 175.380585, 174.35704, 173.331573, 172.308563, 171.29277, 170.27713, 169.273163, 168.259186, 167.245453, 166.210403, 165.186951, 164.195953, 163.20784, 162.20282, 161.235336, 160.268799, 159.28215, 158.28949, 157.322495, 156.363739, 155.394485, 154.430481, 153.471542, 152.523804, 151.578018, 150.639374, 149.713593, 148.796509, 147.886139, 146.98584, 146.092697, 145.192749, 144.273666, 143.350204, 142.474213, 141.635101, 140.811829, 140.020126, 139.600006, 138.87883, 138.150818, 137.421051, 136.676163, 135.918533, 135.15126, 135.133331, 134.340576, 133.540741, 132.751831, 131.963806, 131.178192, 130.385071, 129.59021, 128.801056, 128.009583, 127.22702, 126.441483, 125.663651, 124.886047, 124.107986, 123.334137, 122.562057, 121.999954, 121.166656, 121.0, 120.299118, 119.60025, 118.911514, 118.226517, 117.538605, 116.863647, 116.191223, 115.519699, 114.839066, 114.158752, 113.477951, 112.797043, 112.114349, 111.431427, 110.744141, 110.052628, 109.356384, 108.710007, 108.340073, 107.724884, 107.118484, 106.518951, 105.949997, 105.510513, 105.110001, 104.651566, 104.543335, 104.443329, 104.32666, 104.203339, 104.109161, 104.0, 103.879089, 103.825546, 103.793686, 103.742111]

clubbed_position = np.column_stack((waypoint_lat,waypoint_lon))
latlon = clubbed_position
mapit = folium.Map( location=latlon[[0,1], [0,1]], zoom_start=2,min_zoom=1,max_zoom=8 )
for coord in latlon:
    folium.CircleMarker(location=[ coord[0], coord[1] ], fill_color='#43d9de', radius=5).add_to(mapit)
mapit.save('map.html')

正如你在上面的图片中看到的,路线是分开的(分裂)。我们希望看到一个连续的路径。
请求你的帮助。
致上

gdrx4gfi

gdrx4gfi1#

看一下PolyLine,它可以用来绘制路线:https://nbviewer.org/github/python-visualization/folium/blob/main/examples/Quickstart.ipynb#Polylines

相关问题