Hi there,
I have a very simple bokey script that enables me to draw geometric shapes interactively in the figure (using the mouse). Also changes of the geometries are possible.
Now I am trying to access the coordinates of the geometries that are drawn in the figure. Can the coordinates of the different geometries be saved using python? The coordinates of different geometries should thereby stay seperable (for example if 2 polygons were drawn, each of them should have a own name with which the corresponding coordinates are saved).
Here is my code so far:
# DRAW POLYGONS:
from bokeh.plotting import figure, output_file, show
from bokeh.models import PolyDrawTool, PolyEditTool,CustomJS,ColumnDataSource
p = figure(x_range=(0, 10), y_range=(0, 10), width=1000, height=600,
title='Poly Draw Tool')
#p1 = p.patches([[2, 5, 8]], [[2, 8, 2]], line_width=0, alpha=0.4,fill_color='blue')
l1 = p.multi_line([[1, 9]], [[5, 5]], line_width=5, alpha=0.4, color='red')
p2 = p.patches(line_width=2,alpha=0.3,fill_color='orange',line_color='black')
c1 = p.circle([],[],size=10,color='red')
draw_tool_l1 = PolyDrawTool(renderers=[l1])
draw_tool_p1 = PolyDrawTool(renderers=[p2])
edit_tool_p1 = PolyEditTool(renderers=[l1,p2],vertex_renderer=c1)
p.add_tools(draw_tool_p1, draw_tool_l1,edit_tool_p1)
p.toolbar.active_drag = draw_tool_p1
show(p)
I would be very grateful for your help.
Thanks