Skip to content

Commit a70570b

Browse files
committed
Serve local geojson files instead of doing it remotely
1 parent 2971db4 commit a70570b

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

  • apps/dash-opioid-epidemic

apps/dash-opioid-epidemic/app.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,12 @@ def display_map(year, figure):
291291
)
292292

293293
# base_url = "https://raw.githubusercontent.com/jackparmer/mapbox-counties/master/"
294-
base_url = APP_PATH
295294
for bin in BINS:
295+
link = os.path.join(APP_PATH, os.path.join("data", os.path.join(str(year) + "/" + bin + ".geojson")))
296+
296297
geo_layer = dict(
297298
sourcetype="geojson",
298-
source=os.path.join(base_url, os.path.join("data", os.path.join(str(year) + "/" + bin + ".geojson"))),
299+
source=link,
299300
type="fill",
300301
color=cm[bin],
301302
# color="blue",
@@ -305,13 +306,6 @@ def display_map(year, figure):
305306
)
306307
layout["mapbox"]["layers"].append(geo_layer)
307308

308-
link = os.path.join(base_url, os.path.join("data", os.path.join(str(year) + "/" + "10.1-12" + ".geojson")))
309-
310-
with open("/home/kids_on_drugs/Documents/Plotly/dash-sample-apps/apps/dash-opioid-epidemic/data/1999/0-2.geojson") as f:
311-
data = json.load(f)
312-
print("REACH")
313-
for feature in data["features"]:
314-
print(feature)
315309

316310
fig = dict(data=data, layout=layout)
317311
return fig

0 commit comments

Comments
 (0)