Display glyph circles of data points that are dynamically fetched on GMapPlot

Hi, I am trying to display coordinates on a GMapPlot. The problem is some of the coordinates are dynamically fetched when you zoom into a certain area of the map. I can fetch the coordinate points via a callback and display them without the GMapPlot. But as soon as I try to integrate the two it doesn’t work.

Can you provide a minimal runnable code sample that reproduces the issue? More information about platform, browser, and versions is generally also needed to do any sort of investigation.

Thanks,

Bryan

···

On Feb 4, 2016, at 06:13, [email protected] wrote:

Hi, I am trying to display coordinates on a GMapPlot. The problem is some of the coordinates are dynamically fetched when you zoom into a certain area of the map. I can fetch the coordinate points via a callback and display them without the GMapPlot. But as soon as I try to integrate the two it doesn’t work.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/59ab67b4-8bfa-474f-9f43-5d07d2699e16%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Yeah sure!

···

On Thu, Feb 4, 2016 at 4:18 AM, Bryan Van de Ven [email protected] wrote:

Can you provide a minimal runnable code sample that reproduces the issue? More information about platform, browser, and versions is generally also needed to do any sort of investigation.

Thanks,

Bryan

On Feb 4, 2016, at 06:13, [email protected] wrote:

Hi, I am trying to display coordinates on a GMapPlot. The problem is some of the coordinates are dynamically fetched when you zoom into a certain area of the map. I can fetch the coordinate points via a callback and display them without the GMapPlot. But as soon as I try to integrate the two it doesn’t work.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/59ab67b4-8bfa-474f-9f43-5d07d2699e16%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/943F220C-05AD-4614-A8F8-CCBED8DE8ED0%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sorry. DB and Data are the same source in the examples above. Apologies I have not added those.

···

On Thu, Feb 4, 2016 at 4:34 AM, Nitesh Anandan [email protected] wrote:

Yeah sure!

#################################################################

Here I am fetching data from a source and displaying on a map. Does what it should.

################################################################

Data.init()

SAMPLE_SIZE = 1000

xs, ys = Data.getCurrent(SAMPLE_SIZE)

source = ColumnDataSource(data=dict(x=xs, y=ys))

map_options = GMapOptions(lat=30.29, lng=-97.73, map_type=“roadmap”, zoom=11)

plot = GMapPlot(

x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options, title=“Plot of Stations”

)

circle = Circle(x=“x”, y=“y”, size=15, fill_color=“blue”, fill_alpha=0.8, line_color=None)

plot.add_glyph(source, circle)

plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())

output_file(“gmap_plot.html”)

print type(source)

show(plot)

#################################################################

Here, I am displaying datapoints, some which are obscured/hidden. The hidden ones appear once you zoom into an area in the figure…This functionality works as well via a callback system.

What I am trying to do is to integrate these two pieces so that I can have the map appear behind the circle glyphs/data points, and still have the functionality where the obscured points become visible when you zoom into a specified area.

################################################################

DB.init()

session = push_session(curdoc())

SAMPLE_SIZE = 1000

xs, ys = DB.getCurrent(SAMPLE_SIZE)

source = ColumnDataSource(data=dict(x=xs, y=ys))

plot = Figure(plot_height=800,

plot_width=900,

title=“Plot of Stations”,

tools=“pan, reset, resize, save, wheel_zoom”)

plot.circle(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

def update_coordinates(attrname, old, name):

global N

global xs, ys

xbeg, xend = plot.x_range.start, plot.x_range.end

ybeg, yend = plot.y_range.start, plot.y_range.end

#filtered = filter(lambda pr: xend > pr[0] > xbeg and yend > pr[1] > ybeg, coordinate_cache)

xs, ys = DB.fetch(xbeg, xend, ybeg, yend, SAMPLE_SIZE)

if len(xs) > 0 and len(ys) > 0:

source.data = dict(x=xs, y=ys)

print xbeg, xend

print ybeg, yend

plot.x_range.on_change(‘end’, update_coordinates)

curdoc().add_root(HBox(children=[plot], width=800))

session.show()

session.loop_until_closed()

On Thu, Feb 4, 2016 at 4:18 AM, Bryan Van de Ven [email protected] wrote:

Can you provide a minimal runnable code sample that reproduces the issue? More information about platform, browser, and versions is generally also needed to do any sort of investigation.

Thanks,

Bryan

On Feb 4, 2016, at 06:13, [email protected] wrote:

Hi, I am trying to display coordinates on a GMapPlot. The problem is some of the coordinates are dynamically fetched when you zoom into a certain area of the map. I can fetch the coordinate points via a callback and display them without the GMapPlot. But as soon as I try to integrate the two it doesn’t work.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/59ab67b4-8bfa-474f-9f43-5d07d2699e16%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/943F220C-05AD-4614-A8F8-CCBED8DE8ED0%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Nitesh,

It helps A LOT if you can provide running code even with a few bits of
sample data that we can run so we can see the problem in action.

Would that be possible?

You can just make a fake class with __init__ and fetch methods that
return similar data.

Sincerely,

Sarah Bird

···

On 2/4/16 4:38 AM, Nitesh Anandan wrote:

Sorry. DB and Data are the same source in the examples above. Apologies
I have not added those.

On Thu, Feb 4, 2016 at 4:34 AM, Nitesh Anandan > <[email protected] <mailto:[email protected]>> wrote:

    Yeah sure!
    #################################################################
    Here I am fetching data from a source and displaying on a map. Does
    what it should.
    ################################################################

    Data.__init__()

    SAMPLE_SIZE = 1000
    xs, ys = Data.getCurrent(SAMPLE_SIZE)
    source = ColumnDataSource(data=dict(x=xs, y=ys))

    map_options = GMapOptions(lat=30.29, lng=-97.73, map_type="roadmap",
    zoom=11)

    plot = GMapPlot(
        x_range=DataRange1d(), y_range=DataRange1d(),
    map_options=map_options, title="Plot of Stations"
    )

    circle = Circle(x="x", y="y", size=15, fill_color="blue",
    fill_alpha=0.8, line_color=None)
    plot.add_glyph(source, circle)

    plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())
    output_file("gmap_plot.html")

    print type(source)

    show(plot)

    #################################################################
    Here, I am displaying datapoints, some which are obscured/hidden.
    The hidden ones appear once you zoom into an area in the
    figure...This functionality works as well via a callback system.

    What I am trying to do is to integrate these two pieces so that I
    can have the map appear behind the circle glyphs/data points, and
    still have the functionality where the obscured points become
    visible when you zoom into a specified area.
    ################################################################

    DB.__init__()

    session = push_session(curdoc())
    SAMPLE_SIZE = 1000
    xs, ys = DB.getCurrent(SAMPLE_SIZE)
    source = ColumnDataSource(data=dict(x=xs, y=ys))
    plot = Figure(plot_height=800,
                  plot_width=900,
                  title="Plot of Stations",
                  tools="pan, reset, resize, save, wheel_zoom")

    plot.circle('x', 'y', source=source, line_width=3, line_alpha=0.6)

    def update_coordinates(attrname, old, name):
        global N
        global xs, ys
        xbeg, xend = plot.x_range.start, plot.x_range.end
        ybeg, yend = plot.y_range.start, plot.y_range.end
        #filtered = filter(lambda pr: xend > pr[0] > xbeg and yend >
    pr[1] > ybeg, coordinate_cache)
        xs, ys = DB.fetch(xbeg, xend, ybeg, yend, SAMPLE_SIZE)

        if len(xs) > 0 and len(ys) > 0:
            source.data = dict(x=xs, y=ys)

        print xbeg, xend
        print ybeg, yend

    plot.x_range.on_change('end', update_coordinates)
    curdoc().add_root(HBox(children=[plot], width=800))
    session.show()
    session.loop_until_closed()

    On Thu, Feb 4, 2016 at 4:18 AM, Bryan Van de Ven > <[email protected] <mailto:[email protected]>> wrote:

        Can you provide a minimal runnable code sample that reproduces
        the issue? More information about platform, browser, and
        versions is generally also needed to do any sort of investigation.

        Thanks,

        Bryan

        On Feb 4, 2016, at 06:13, [email protected] > <mailto:[email protected]> wrote:

        Hi, I am trying to display coordinates on a GMapPlot. The
        problem is some of the coordinates are dynamically fetched
        when you zoom into a certain area of the map. I can fetch the
        coordinate points via a callback and display them without the
        GMapPlot. But as soon as I try to integrate the two it
        doesn't work.

        --
        You received this message because you are subscribed to the
        Google Groups "Bokeh Discussion - Public" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to [email protected]
        <mailto:[email protected]>.
        To post to this group, send email to [email protected]
        <mailto:[email protected]>.
        To view this discussion on the web visit
        https://groups.google.com/a/continuum.io/d/msgid/bokeh/59ab67b4-8bfa-474f-9f43-5d07d2699e16%40continuum.io
        <https://groups.google.com/a/continuum.io/d/msgid/bokeh/59ab67b4-8bfa-474f-9f43-5d07d2699e16%40continuum.io?utm_medium=email&utm_source=footer&gt;\.
        For more options, visit
        https://groups.google.com/a/continuum.io/d/optout\.

        --
        You received this message because you are subscribed to the
        Google Groups "Bokeh Discussion - Public" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to [email protected]
        <mailto:[email protected]>.
        To post to this group, send email to [email protected]
        <mailto:[email protected]>.
        To view this discussion on the web visit
        https://groups.google.com/a/continuum.io/d/msgid/bokeh/943F220C-05AD-4614-A8F8-CCBED8DE8ED0%40continuum.io
        <https://groups.google.com/a/continuum.io/d/msgid/bokeh/943F220C-05AD-4614-A8F8-CCBED8DE8ED0%40continuum.io?utm_medium=email&utm_source=footer&gt;\.

        For more options, visit
        https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google
Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BoUPP6-MWA%2BYAaeYZnkuSxsqBw31FgbdCAaEeC5nagQ9gFzJg%40mail.gmail.com
<https://groups.google.com/a/continuum.io/d/msgid/bokeh/CA%2BoUPP6-MWA%2BYAaeYZnkuSxsqBw31FgbdCAaEeC5nagQ9gFzJg%40mail.gmail.com?utm_medium=email&utm_source=footer&gt;\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.