I am using plotlys scattermapbox to plot points on a map. I’d like to draw the polygon that cover 'x' mile
radius from a POI.
dcc.Graph(id="map-graph"),
@application.callback([
Output("map-graph", "figure"),
],
[
Input("address", "value"),
Input("type", "value")
]
)
def update_graph(address, type):
for i, row in df.iterrows():
lat = row["Lat"]
lng = row["Long"]
data.append({
"type": "scattermapbox",
"lat": [lat],
"lon": [lng],
"name": "Location",
"showlegend": False,
"hoverinfo": "text",
"mode": "markers",
"marker": {
"symbol": "circle",
"size": 8,
"opacity": 0.8,
"color": "black"
}
}
)
# Plot POI
POI_Lat = 37.785908
POI_Long = -122.400803
data.append({
"type": "scattermapbox",
"lat": [POI_Lat],
"lon": [POI_Long],
"marker": {
"symbol": "circle,
"size": 28,
"opacity": 0.7,
"color": "rgb(128, 128, 128)"
}
}
)
df
is a pandas dataframe that includes coordinates for locations within x miles
of POI. How do I update the map-graph
to draw a polygon that covers all the points?