Linking x and y_ranges for GMapPlot

I’m trying to generate a series of GMapPlots with linked axes. I have linked the ranges as one would with a normal plot. This works but only links the plotted glyphs, not the google map background. If you zoom in on one map, the points on the other map also zoom in, but the background map remains stagnant and hence lose their correct location. Is it possible to link the google map range as well? Thanks!

map_options = GMapOptions(**gmapoptions)
plot1 = GMapPlot(**gmapplotoptions)

circle = Circle(x="lon", y="lat", size=8, fill_color='colors', fill_alpha=0.5, line_color=None)
plot1.add_glyph(source, circle)

map_options = GMapOptions(**gmapoptions)
plot2 = GMapPlot(**gmapplotoptions)

circle = Circle(x="lon", y="lat", size=8, fill_color='colors', fill_alpha=0.5, line_color=None)
plot2.add_glyph(source, circle)


plot1.x_range=plot2.x_range
plot1.y_range=plot2.y_range


p = vplot(plot1, plot2)

show(p)

Google Maps insist on controlling the displayed view bounds in order to maintain a specific aspect ratio. It is not possible to arbitrarily set the bounds of of a Google Map, you can merely give it a suggested rectangular area, and it computes display bounds to contain that suggested area, according to its own rules. We have no control over that behaviour. If you want a single Google Map to drive other non-GMapPlots, I would say that's probably fine. If you need two GMapPlots linked or want non-GMapPlot ranges to drive a GMapPlot range, I am not sure there is anything that can be done. Though perhaps others will have ideas I am not aware of.

I will say there are new TileRenderer classes that can use different tile sources (e.g. Open Layers) besides Google Maps, and these can have their bounds set arbitrarily. Perhaps that might be a better option to investigate for this use-case.

Bryan

···

On Jan 19, 2016, at 3:54 PM, [email protected] wrote:

I'm trying to generate a series of GMapPlots with linked axes. I have linked the ranges as one would with a normal plot. This works but only links the plotted glyphs, not the google map background. If you zoom in on one map, the points on the other map also zoom in, but the background map remains stagnant and hence lose their correct location. Is it possible to link the google map range as well? Thanks!

map_options = GMapOptions(**gmapoptions)
plot1 = GMapPlot(**gmapplotoptions)

circle = Circle(x="lon", y="lat", size=8, fill_color='colors', fill_alpha=0.5, line_color=None)
plot1.add_glyph(source, circle)

map_options = GMapOptions(**gmapoptions)
plot2 = GMapPlot(**gmapplotoptions)

circle = Circle(x="lon", y="lat", size=8, fill_color='colors', fill_alpha=0.5, line_color=None)
plot2.add_glyph(source, circle)

plot1.x_range=plot2.x_range
plot1.y_range=plot2.y_range

p = vplot(plot1, plot2)

show(p)

--
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/0b6a0658-72f8-48e4-98eb-d4e46e305162%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan! Looks like I should look into open layers. Two followups. First, Is there a way to access that rectangle through a GMapPlot instance or would we have to go with the straight google api? Secondly, in a single GMapplot instance how is the the plot scaled to the gmap if you can’t set the Gmap bounds? Is the rectangle specified, then actual map bounds retrieved and then the plot scaled accordingly?

Thanks,

Evan

···

On Tuesday, January 19, 2016 at 2:02:40 PM UTC-8, Bryan Van de ven wrote:

Google Maps insist on controlling the displayed view bounds in order to maintain a specific aspect ratio. It is not possible to arbitrarily set the bounds of of a Google Map, you can merely give it a suggested rectangular area, and it computes display bounds to contain that suggested area, according to its own rules. We have no control over that behaviour. If you want a single Google Map to drive other non-GMapPlots, I would say that’s probably fine. If you need two GMapPlots linked or want non-GMapPlot ranges to drive a GMapPlot range, I am not sure there is anything that can be done. Though perhaps others will have ideas I am not aware of.

I will say there are new TileRenderer classes that can use different tile sources (e.g. Open Layers) besides Google Maps, and these can have their bounds set arbitrarily. Perhaps that might be a better option to investigate for this use-case.

Bryan

On Jan 19, 2016, at 3:54 PM, [email protected] wrote:

I’m trying to generate a series of GMapPlots with linked axes. I have linked the ranges as one would with a normal plot. This works but only links the plotted glyphs, not the google map background. If you zoom in on one map, the points on the other map also zoom in, but the background map remains stagnant and hence lose their correct location. Is it possible to link the google map range as well? Thanks!

map_options = GMapOptions(**gmapoptions)

plot1 = GMapPlot(**gmapplotoptions)

circle = Circle(x=“lon”, y=“lat”, size=8, fill_color=‘colors’, fill_alpha=0.5, line_color=None)

plot1.add_glyph(source, circle)

map_options = GMapOptions(**gmapoptions)

plot2 = GMapPlot(**gmapplotoptions)

circle = Circle(x=“lon”, y=“lat”, size=8, fill_color=‘colors’, fill_alpha=0.5, line_color=None)

plot2.add_glyph(source, circle)

plot1.x_range=plot2.x_range

plot1.y_range=plot2.y_range

p = vplot(plot1, plot2)

show§


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/0b6a0658-72f8-48e4-98eb-d4e46e305162%40continuum.io.

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