Looking for GeoJSPlot Example

I’m looking for a working example of GeoJSPlot. Setting geojs=False in the code below creates a functional GMapPlot. If geojs=True, however, no error is returned, but the html page won’t display either. Any idea what the problem is, or where I can find a working example?
Sidenote: any idea why ResetTool() reverts to lat, lon = (0,0)?

···

from future import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, GeoJSPlot, Range1d, ColumnDataSource, LinearAxis,
PanTool, WheelZoomTool, BoxSelectTool, ResetTool,
BoxSelectionOverlay, GMapOptions, GeoJSOptions, GeoJSPlot,
NumeralTickFormatter, PrintfTickFormatter)
from bokeh.resources import INLINE

geojs = True

gmap_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type=“roadmap”, zoom=13)
geojs_map_options = GeoJSOptions(lat=30.2861, lng=-97.7394, zoom=13)

x_range = Range1d()
y_range = Range1d()

if geojs:
plot = GeoJSPlot(
x_range=x_range, y_range=y_range,
map_options=geojs_map_options,
title = “Austin”)
else:
plot = GMapPlot(
x_range=x_range, y_range=y_range,
map_options=gmap_options,
title = “Austin”)

source = ColumnDataSource(
data=dict(
lat=[30.2861, 30.2855, 30.2869],
lon=[-97.7394, -97.7390, -97.7405],
fill=[‘orange’, ‘blue’, ‘green’]
)
)

circle = Circle(x=“lon”, y=“lat”, size=15, fill_color=“fill”, line_color=“black”)
plot.add_glyph(source, circle)

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

xaxis = LinearAxis(axis_label=“lat”, major_tick_in=0, formatter=NumeralTickFormatter(format=“0.000”))
plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis(axis_label=“lon”, major_tick_in=0, formatter=PrintfTickFormatter(format="%.3f"))
plot.add_layout(yaxis, ‘left’)

doc = Document()
doc.add(plot)

if name == “main”:
filename = “maps.html”
with open(filename, “w”) as f:
f.write(file_html(doc, INLINE, “Maps Example”))
print(“Wrote %s” % filename)
view(filename)

``

The JavaScript sources for GeoJS plots were never versioned or hosted on a proper CDN, AFAIK, which effectively makes supporting them unmaintainable. We are going to remove GeoJSPlot in the very near future. However, we are also currently working on an OpenLayers renderer, so you will be able to have tiled data from any OLS supported source.

Bryan

···

On Sep 8, 2015, at 12:15 PM, Adam Van Etten <[email protected]> wrote:

I'm looking for a working example of GeoJSPlot. Setting geojs=False in the code below creates a functional GMapPlot. If geojs=True, however, no error is returned, but the html page won't display either. Any idea what the problem is, or where I can find a working example?
Sidenote: any idea why ResetTool() reverts to lat, lon = (0,0)?

from __future__ import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
    GMapPlot, GeoJSPlot, Range1d, ColumnDataSource, LinearAxis,
    PanTool, WheelZoomTool, BoxSelectTool, ResetTool,
    BoxSelectionOverlay, GMapOptions, GeoJSOptions, GeoJSPlot,
    NumeralTickFormatter, PrintfTickFormatter)
from bokeh.resources import INLINE

geojs = True

gmap_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=13)
geojs_map_options = GeoJSOptions(lat=30.2861, lng=-97.7394, zoom=13)

x_range = Range1d()
y_range = Range1d()

if geojs:
    plot = GeoJSPlot(
        x_range=x_range, y_range=y_range,
        map_options=geojs_map_options,
        title = "Austin")
else:
    plot = GMapPlot(
        x_range=x_range, y_range=y_range,
        map_options=gmap_options,
        title = "Austin")

source = ColumnDataSource(
    data=dict(
        lat=[30.2861, 30.2855, 30.2869],
        lon=[-97.7394, -97.7390, -97.7405],
        fill=['orange', 'blue', 'green']
    )
)

circle = Circle(x="lon", y="lat", size=15, fill_color="fill", line_color="black")
plot.add_glyph(source, circle)

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

xaxis = LinearAxis(axis_label="lat", major_tick_in=0, formatter=NumeralTickFormatter(format="0.000"))
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis(axis_label="lon", major_tick_in=0, formatter=PrintfTickFormatter(format="%.3f"))
plot.add_layout(yaxis, 'left')

doc = Document()
doc.add(plot)

if __name__ == "__main__":
    filename = "maps.html"
    with open(filename, "w") as f:
        f.write(file_html(doc, INLINE, "Maps Example"))
    print("Wrote %s" % filename)
    view(filename)

--
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/8d5c53ec-72d4-40a0-b70e-eaad0345a26b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.