Hello,
I am trying to get a scattermapbox rendered following the example here. I believe I’m performing the actions necessary, but it seems to hang on the “Loading…” page. I create a small example in python below:
import dash
import json
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import geopandas as gpd
# public token
mapbox_access_token = 'pk.eyJ1IjoiYWpzNTEyMTAiLCJhIjoiY2pubTF0bmd0MW1xZDNrcG11MzFtcmRkMyJ9.VV44hkCsoc8ZcKYbH9wfbA'
app = dash.Dash(__name__)
gdf = gpd.read_file( 'https://raw.githubusercontent.com/TNRIS/tx.geojson/master/counties/tx_counties.geojson' )
app.layout = html.Div( [ dcc.Graph(
id = 'TxWCD-choropleth',
figure = dict(
data = [dict(
type = 'scattermapbox'
)],
layout = dict(
height = 900,
autosize = True,
mapbox = dict(
layers =[dict(
sourcetype = 'geojson',
type = 'fill',
color = '#265465',
source = json.loads( gdf.to_json() )
)],
accesstoken = mapbox_access_token,
center = dict(
lat = 31.3,
lon = -99.2
),
zoom = 5.2,
style='light'
)
)
)
)])
if __name__ == '__main__':
app.run_server( port = 8051, debug = True )
weirdly if I change the geopandas object to instead read https://raw.githubusercontent.com/TNRIS/tx.geojson/master/tx.geojson
it works, but is slow. I wonder if it has something to do with the data size. I was running it before and it worked fine, this just started happening once I updated some packages on pip. Any help would be greatly appreciated.
Thanks!