See attached screenshot. How can I fix that weird behaviour? All coords I submit are “in the water” and at 180deg lon there’s a cutoff (they are not connected). It works perfectly fine for every set of coords which “does not cross the pacific”.
Since this problem is exclusive to lines that go “around the world”, meaning lines that cross 180 deg lon (and I’m pretty sure the order is correct too) I don’t think that’s it
#waypoints is a pandas df with columns lon and lat in degrees ranging from -180 to 180
waypoints=pd.DataFrame(waypoints)
diffs=np.diff(lons:=waypoints.lon.values)
#the number 180 depends on your "step size", may need customization
crossings_plusminus=np.where(diffs<=-180)[0]
crossing_minusplus=np.where(diffs>180)[0]
for plusmin_crossing in crossings_plusminus:
lons[plusmin_crossing+1:]+=360
for minusplus_crossing in crossing_minusplus:
lons[minusplus_crossing+1:]-=360
fig = px.line_mapbox(lat=waypoints.lat, lon=lons)