Download notebook (.ipynb)

Param geodesic in geom_segment() and geom_path()#

With geodesic=True a segment will be transformed to a curve representing the shortest path between two points on the surface of Earth.

Note that this parameter only works when functions geom_path() and geom_segment() are used in combination with geom_livemap().

import pandas as pd

from lets_plot import *
LetsPlot.setup_html()
LetsPlot.set(maptiles_lets_plot(theme='dark'))

By Default, a Segment on Map is a Straight Line#

ggplot() + geom_livemap() + \
    geom_segment(x=-122.25165, y=37.464958, xend=139.4130, yend=35.4122, color='white', size=1)

Segment with geodesic=True#

With geodesic=True a segment on map becomes an arc.

ggplot() + geom_livemap() + \
    geom_segment(x=-122.25165, y=37.464958, xend=139.4130, yend=35.4122, geodesic=True, color='white', size=1)

geom_path() with geodesic=True#

data = {
    'city': ['New York', 'San-Francisco', 'Tokyo'],
    'lon': [-73.935242, -122.25165, 139.4130],
    'lat': [40.730610, 37.464958, 35.4122],
}
ggplot(data) + \
    geom_livemap() + \
    geom_path(aes(x='lon', y='lat'), color='white', size=1, linetype="dotted") + \
    geom_path(aes(x='lon', y='lat'), geodesic=True, color='white', size=1)