Update app.py
Browse files
app.py
CHANGED
|
@@ -49,11 +49,16 @@ app.layout = html.Div([
|
|
| 49 |
def actualizar_mapa(selection):
|
| 50 |
if not selection or "points" not in selection:
|
| 51 |
return "Select at least one point.", ""
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
global df_seg
|
| 54 |
-
|
| 55 |
-
lSegments = get_segment(df_seg ,
|
| 56 |
-
|
| 57 |
m = folium.Map(location=[-0.19204405740703162, -78.47700359958313], zoom_start=10)
|
| 58 |
|
| 59 |
color_list = [
|
|
@@ -74,7 +79,7 @@ def actualizar_mapa(selection):
|
|
| 74 |
fig.add_child(m)
|
| 75 |
mapa_html = m.get_root().render()
|
| 76 |
|
| 77 |
-
return "
|
| 78 |
|
| 79 |
if __name__ == "__main__":
|
| 80 |
app.run(host="0.0.0.0", port=7860)
|
|
|
|
| 49 |
def actualizar_mapa(selection):
|
| 50 |
if not selection or "points" not in selection:
|
| 51 |
return "Select at least one point.", ""
|
| 52 |
+
try:
|
| 53 |
+
ids = [p['customdata'][0] for p in selection['points']]
|
| 54 |
+
except (KeyError, TypeError):
|
| 55 |
+
# Fallback por si no llega customdata
|
| 56 |
+
ids = [int(p['hovertext']) for p in selection['points']]
|
| 57 |
+
|
| 58 |
global df_seg
|
| 59 |
+
|
| 60 |
+
lSegments = get_segment(df_seg , ids)
|
| 61 |
+
|
| 62 |
m = folium.Map(location=[-0.19204405740703162, -78.47700359958313], zoom_start=10)
|
| 63 |
|
| 64 |
color_list = [
|
|
|
|
| 79 |
fig.add_child(m)
|
| 80 |
mapa_html = m.get_root().render()
|
| 81 |
|
| 82 |
+
return f"IDs : {ids}" , mapa_html
|
| 83 |
|
| 84 |
if __name__ == "__main__":
|
| 85 |
app.run(host="0.0.0.0", port=7860)
|