Black Lives Matter. Please consider donating to Black Girls Code today.

Problem: Plotting Roads takes to long

Hello,
I’ve got a problem with my Dash App. The app plots roads on a mapbox, but the process takes about 20 min until the map with the roads is shown. Is it possible to plot faster or did I do anything wrong?

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import Database
from shapely.geometry import LineString, shape
from plotly.offline import download_plotlyjs, init_notebook_mode, plot
import plotly.graph_objs as go
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

In the following Part the Segemts are queried from the Database

def getSegments():

# Database
# returns a geopandas Dataframe
geo = dbc.connectionGeoPandas("SELECT linkid, name, geom FROM blt_map")

# creates a list with all the roads
segments = []
for index, row in geo.iterrows():
    geoList = list((row['geom']).coords)
    lats = []
    longs = []

    for obj in geoList:
        longs.append(obj[0])
        lats.append(obj[1])
    segments.append(dict(type='scattermapbox', name=row['name'], lon=longs, lat=lats, mode='lines', line=dict(width=2, color='red')))
return segments
# Get the roads
segments = getSegments()
app.layout = html.Div([
    html.H1("Melbourne"),
    html.Div([
        # Dropdown for weekdays
        html.Label("Weekday"),
        dcc.Dropdown(
            id='dropdown_weekdays',
            options=[
                {'label': 'Monday', 'value': 'Monday'},
                {'label': 'Tuesday', 'value': 'Tuesday'},
                {'label': 'Wednesday', 'value': 'Wednesday'},
                {'label': 'Thursday', 'value': 'Thursday'},
                {'label': 'Friday', 'value': 'Friday'},
                {'label': 'Saturday', 'value': 'Saturday'},
                {'label': 'Sunday', 'value': 'Sunday'}
            ], value='Monday'
        ),
    ]),

    html.Div([
        # Slider for Hours
        html.Label("Hour"),
        dcc.Slider(
            id='slider_hour',
            min=0,
            max=23,
            marks={i: str(i) for i in range(0, 24)},
            value=0,
        ),
    ]),

    html.Div([
        dcc.Graph(id='my-map',
            figure={'data': segments,
                  'layout':{
                      'autosize': True,
                      'showlegend': False,
                      'hovermmode': 'closet',
                      'mapbox':{
                          'accesstoken': 'accesstoken',
                          'center': {
                              'lat': -37.81501,
                              'lon': 144.946014
                             },
                             'zoom': 11
                         },
                         'margin': {
                             'l': 5, 'r': 11, 'b': 11, 't': 11
                         },
                   }
            }


        )
    ])
])


if __name__ == '__main__':
    app.run_server(debug=True)