Download notebook (.ipynb)

Geodesic lines on livemap: flat parameter#

Parameter flat enables or disables geodesic lines on livemap.

Layers that support flat parameter are geom_segment() and geom_path():

  • False (by default) - allows projection to curve a line

  • True - keeps a line flat

from lets_plot import *
LetsPlot.setup_html()
LetsPlot.set(maptiles_lets_plot(theme='dark'))
data = {
    'lon': [-73.7997, -149.9002],
    'lat': [40.6408, 61.2180],
}

Default Presentation#

By default a geodesic is drawn for geom_path() and geom_segment() on livemap. It is the shortest path between points on earth.

(ggplot(data, aes(x='lon', y='lat'))
  + geom_livemap()
  + geom_path(color='white', size=1))

With flat=True#

If it is necessary to indicate distances for example, travel routes, a straight line is better. This is how geom_path() is rendered with parameter flat=True on livemap.

(ggplot(data, aes(x='lon', y='lat'))
  + geom_livemap()
  + geom_path(color='white', size=1,
              flat=True))  # <----