The map shows in the layout defined in my app.py file. I defined here a callback that launches a request to an api and returns a geodataframe.
...
@app.callback(
Output("esiti-layer","data"),
State("date-from","value"), #datepicker
State("date-to","value") #datepicker
)
def update_dashboard(date_from, date_to):
gdf = fetch_geodata(date_from, date_to) #this function fetches a geojson from a third party api and returns a geopandas geodataframe
gdf.set_crs(epsg="4326", inplace=True)
print(gdf.head(10) #just to check...
layer_data = gdf.__geo_interface__
...
And nothing happens to my map when the callback fires! What’s wrong? Thanks for your help!
I’m still stuck, but it seems the data is correctly passed to Dash Leaflet—if I deliberately return invalid data from the callback, Dash throws an error.
If you run the MWE, no errors are reported but the geojson layer is not populated with the data (or I have to force the re-rendering in some way?)