add geojson tooltip and color example
@@ -2,12 +2,21 @@ from bokeh.io import output_file, show
from bokeh.models import GeoJSONDataSource
from bokeh.plotting import figure
from bokeh.sampledata.sample_geojson import geojson
+import json
output_file("geojson.html")
-geo_source = GeoJSONDataSource(geojson=geojson)
+data = json.loads(geojson)
+for i in range(len(data['features'])):
+ data['features'][i]['properties']['Color'] = ['blue', 'red'][i%2]
-p = figure(background_fill_color="lightgrey")
-p.circle(x='x', y='y', size=15, alpha=0.7, source=geo_source)
+geo_source = GeoJSONDataSource(geojson=json.dumps(data))
+
+TOOLTIPS = [
+ ('Organisation', '@OrganisationName')
+]
+
+p = figure(background_fill_color="lightgrey", tooltips=TOOLTIPS)
+p.circle(x='x', y='y', size=15, color='Color', alpha=0.7, source=geo_source)
show(p)
