World map with divisions (GeoJSON data) + mouse-over data

Greetings,

I am doing an experiment with Bokeh for my class. I would like to generate a world map with various subvisions (countries, or perhaps regions in countries) and have hover-text appear when the mouse is over that region. So this is a choropleth map with some interactivity.

I am fairly certain this is do-able in Bokeh as I have seen some similar tasks accomplished, but I am curious how much effort it will take.

For example, texas.py — Bokeh 2.4.2 Documentation

does essentially what I would like to do. Only in a world map, some countries have multiple closed polygons, and similarly some countries have cut-out regions on the inside. So the Texas example is a little bit too simple for my task.

I downloaded my shape data (a by-country division of the world) from Natural Earth and converted it to GeoJSON data with Fiona.

I follow the above Texas example, so I convert the GeoJSON data to a list of x-coordinates and y-coordinates of the polygons and Afghanistan is handled fine. But once it gets to Angola it fails. This is because Angola is not a single loop, it consists of two disconnected closed-loop borders.

I am wondering what a good way to handle this in Bokeh might be. Does Bokeh have a preferred way, or would it be best to just have Bokeh think in terms of closed polygons? I have not found any precise documentation for how Bokeh thinks about polygons. Are polygons in Bokeh always required to be simple closed curves, or are there ways to get around that?

For a country like Angola, one solution would be to have multiple closed polygons (i.e. occupying two elements in “source” in the Texas example linked to above) and give both closed polygons links to the same hover text.

But for countries with cut-out regions (like South Africa) is there a simple way to get Bokeh to respect the actual polygonal structure given in a GeoJSON file?

Hi Ryan,

There’s discussion going about this currently. see e.g. this issue https://github.com/bokeh/bokeh/issues/3708 and this PR https://github.com/bokeh/bokeh/pull/3399) but patches with holes are not yet supported

···

On Sun, Mar 6, 2016, 4:43 PM [email protected] wrote:

Greetings,

I am doing an experiment with Bokeh for my class. I would like to generate a world map with various subvisions (countries, or perhaps regions in countries) and have hover-text appear when the mouse is over that region. So this is a choropleth map with some interactivity.

I am fairly certain this is do-able in Bokeh as I have seen some similar tasks accomplished, but I am curious how much effort it will take.

For example, http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

does essentially what I would like to do. Only in a world map, some countries have multiple closed polygons, and similarly some countries have cut-out regions on the inside. So the Texas example is a little bit too simple for my task.

I downloaded my shape data (a by-country division of the world) from Natural Earth and converted it to GeoJSON data with Fiona.

I follow the above Texas example, so I convert the GeoJSON data to a list of x-coordinates and y-coordinates of the polygons and Afghanistan is handled fine. But once it gets to Angola it fails. This is because Angola is not a single loop, it consists of two disconnected closed-loop borders.

I am wondering what a good way to handle this in Bokeh might be. Does Bokeh have a preferred way, or would it be best to just have Bokeh think in terms of closed polygons? I have not found any precise documentation for how Bokeh thinks about polygons. Are polygons in Bokeh always required to be simple closed curves, or are there ways to get around that?

For a country like Angola, one solution would be to have multiple closed polygons (i.e. occupying two elements in “source” in the Texas example linked to above) and give both closed polygons links to the same hover text.

But for countries with cut-out regions (like South Africa) is there a simple way to get Bokeh to respect the actual polygonal structure given in a GeoJSON file?

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/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io.

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

Thanks for letting me know. Okay, I’ll keep my eyes on revisions to Bokeh. It sounds like I won’t be able to get this demo prepped for my class this semester.

I’ve had some success using Folium and plot.ly for this task, but plot.ly seems pretty limited with the hover text information, and I’ve had no luck getting hover text working in Folium. Presumably there is a way but the documentation makes it a bit of a mystery…

···

On Sunday, March 6, 2016 at 2:44:47 PM UTC-8, James Santucci wrote:

Hi Ryan,

There’s discussion going about this currently. see e.g. this issue https://github.com/bokeh/bokeh/issues/3708 and this PR https://github.com/bokeh/bokeh/pull/3399) but patches with holes are not yet supported

Hi Ryan,

    Thanks                 for

your email, supporting countries like South Africa / Lesotho
has been on my mind for nearly a year now, and as you can see
from the PR referenced. Unfortunately its
been more complicated than
hoped - we need to pick a new interface and haven’t done so yet as other priorities
have come along.

                      **HOWEVER****                          ,**Bokeh does now support GeoJSON direct                                    ly - have you

tried just putting in your GeoJSON and seeing
what you get out:

                                                  If you share your

GeoJSON I can
also try a nd
help.

                            Sincerely,

                              Sarah Bird
···

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py
On 3/6/16 12:44 PM,
wrote:

[email protected]

Greetings,

      I am doing an experiment with Bokeh for my class.  I would

like to generate a world map with various subvisions
(countries, or perhaps regions in countries) and have
hover-text appear when the mouse is over that region. So this
is a choropleth map with some interactivity.

      I am fairly certain this is do-able in Bokeh as I have seen

some similar tasks accomplished, but I am curious how much
effort it will take.

      For

example,

      does essentially what I would like to do.  Only in a world

map, some countries have multiple closed polygons, and
similarly some countries have cut-out regions on the inside.
So the Texas example is a little bit too simple for my task.

      I downloaded my shape data (a by-country division of the

world) from Natural Earth
and converted it to GeoJSON data with Fiona.

      I follow the above Texas example, so I convert the GeoJSON

data to a list of x-coordinates and y-coordinates of the
polygons and Afghanistan is handled fine. But once it gets to
Angola it fails. This is because Angola is not a single loop,
it consists of two disconnected closed-loop borders.

      I am wondering what a good way to handle this in Bokeh

might be. Does Bokeh have a preferred way, or would it be
best to just have Bokeh think in terms of closed polygons? I
have not found any precise documentation for how Bokeh thinks
about polygons. Are polygons in Bokeh always required to be
simple closed curves, or are there ways to get around that?

      For a country like Angola, one solution would be to have

multiple closed polygons (i.e. occupying two elements in
“source” in the Texas example linked to above) and give both
closed polygons links to the same hover text.

      But for countries with cut-out regions (like South Africa)

is there a simple way to get Bokeh to respect the actual
polygonal structure given in a GeoJSON file?

  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/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

http://bokeh.pydata.org/en/latest/docs/gallery/texas.htmlhttps://groups.google.com/a/continuum.io/d/msgid/bokeh/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io
https://groups.google.com/a/continuum.io/d/optout

Thanks Sarah,

I did not know about the GeoJSON support. My basic first attempt went like this:

import bokeh as bk
import json
from bokeh.models import GeoJSONDataSource
from bokeh.plotting import figure, show
p=figure()
p.patches(x='x’y=,‘y’,source=GeoJSONDataSource(geojson=json.load(datafilename)))
show(p)

As I would eventually like to have mouse-over effects. But perhaps I misinterpreted your comment. The GeoJSON support is perhaps only for things like x,y coordinates, it is not for polygonal regions (patches)?

On my first attempt, the i-python notebook freezes up, and an error message appears. I can’t scroll down because the window is frozen… Presumably I don’t understand the syntax bokeh is looking for.

datafilename is a geojsonfile, the 110m resolution map of world country boundaries, from Natural Earth, converted to geojson using the fiona library. I’ve attached a zip, as it’s a rather large file.

-ryan

world110.zip (1.04 MB)

···

On Monday, March 7, 2016 at 2:40:49 PM UTC-8, Sarah Bird wrote:

Hi Ryan,

    Thanks                 for

your email, supporting countries like South Africa / Lesotho
has been on my mind for nearly a year now, and as you can see
from the PR referenced. Unfortunately its
been more complicated than
hoped - we need to pick a new interface and haven’t done so yet as other priorities
have come along.

                      **HOWEVER****                          ,**Bokeh does now support GeoJSON direct                                    ly - have you

tried just putting in your GeoJSON and seeing
what you get out:
https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

                                                  If you share your

GeoJSON I can
also try a nd
help.

                            Sincerely,



                              Sarah Bird




  On 3/6/16 12:44 PM, > [email protected] wrote:

Greetings,

      I am doing an experiment with Bokeh for my class.  I would

like to generate a world map with various subvisions
(countries, or perhaps regions in countries) and have
hover-text appear when the mouse is over that region. So this
is a choropleth map with some interactivity.

      I am fairly certain this is do-able in Bokeh as I have seen

some similar tasks accomplished, but I am curious how much
effort it will take.

      For

example, http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

      does essentially what I would like to do.  Only in a world

map, some countries have multiple closed polygons, and
similarly some countries have cut-out regions on the inside.
So the Texas example is a little bit too simple for my task.

      I downloaded my shape data (a by-country division of the

world) from Natural Earth
and converted it to GeoJSON data with Fiona.

      I follow the above Texas example, so I convert the GeoJSON

data to a list of x-coordinates and y-coordinates of the
polygons and Afghanistan is handled fine. But once it gets to
Angola it fails. This is because Angola is not a single loop,
it consists of two disconnected closed-loop borders.

      I am wondering what a good way to handle this in Bokeh

might be. Does Bokeh have a preferred way, or would it be
best to just have Bokeh think in terms of closed polygons? I
have not found any precise documentation for how Bokeh thinks
about polygons. Are polygons in Bokeh always required to be
simple closed curves, or are there ways to get around that?

      For a country like Angola, one solution would be to have

multiple closed polygons (i.e. occupying two elements in
“source” in the Texas example linked to above) and give both
closed polygons links to the same hover text.

      But for countries with cut-out regions (like South Africa)

is there a simple way to get Bokeh to respect the actual
polygonal structure given in a GeoJSON file?

  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/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io?utm_medium=email&utm_source=footer)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io).

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


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px">
    ](http://continuum.io)

You’ve got the right idea, but p atches takes xs and ys
not x and y. (This is the kind of
thin g that I’d hope you
don’t have to know in
the future for geo
support)

                    Here's it working:

<img src="//bokeh-discourse-uploads.s3.dualstack.us-east-1.amazonaws.com/original/1X/1311e4fe562c0f801c41e6f4053487ee46049ada.png" style="max-height: 300px; max-width: 400px">

                                                  (it will take a

while to load be cause
that world map data is very la rge

  • I would suggest you consider going with
    a lower resolution one)

                                      Best,
    
                                        Bird
    
···

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True
On 3/7/16 3:14 PM, Ryan Budney wrote:

Thanks Sarah,

      I did not know about the GeoJSON support.  My basic first

attempt went like this:

      import

bokeh as bk
import
json
from
bokeh.models import GeoJSONDataSource

      from bokeh.plotting import figure, show

      p=figure()

p.patches(x='x’y=,‘y’,source=GeoJSONDataSource(geojson=json.load(datafilename)))

      show(p)
      As I would eventually like to have mouse-over effects.  But

perhaps I misinterpreted your comment. The GeoJSON support is
perhaps only for things like x,y coordinates, it is not for
polygonal regions (patches)?

      On my first attempt, the i-python notebook freezes up, and

an error message appears. I can’t scroll down because the
window is frozen… Presumably I don’t understand the syntax
bokeh is looking for.

      datafilename is a geojsonfile, the 110m resolution map of

world country boundaries, from Natural Earth, converted to
geojson using the fiona library. I’ve attached a zip, as it’s
a rather large file.

-ryan

      On Monday, March 7, 2016 at 2:40:49 PM UTC-8, Sarah Bird

wrote:

Hi Ryan,

              Thanks for your email, supporting countries like South Africa / Lesotho
          has been on my mind for nearly a year now, and as you can

see from the PR referenced .
Unfortunately its been more complicated than hoped

  • we need to pick a new interface and haven’t done so yet as other
    priorities have come along.

                              **HOWEVER****                                ,**                                  Bokeh
    

does no w
support G eoJSON
direct ly - have you tried just
putting in your GeoJSON and
seeing what you get out :
https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

                                                              If you share

your GeoJSON I can also try and help.

                                  Sincerely,



                                                                              Sarah

Bird

On 3/6/16 12:44 PM, [email protected]
wrote:

Greetings,

                I am doing an experiment with Bokeh for my class.

I would like to generate a world map with various
subvisions (countries, or perhaps regions in
countries) and have hover-text appear when the mouse
is over that region. So this is a choropleth map
with some interactivity.

                I am fairly certain this is do-able in Bokeh as I

have seen some similar tasks accomplished, but I am
curious how much effort it will take.

For example, http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

                does essentially what I would like to do.  Only

in a world map, some countries have multiple closed
polygons, and similarly some countries have cut-out
regions on the inside. So the Texas example is a
little bit too simple for my task.

                I downloaded my shape data (a by-country division

of the world) from Natural Earth and converted it to
GeoJSON data with Fiona.

                I follow the above Texas example, so I convert

the GeoJSON data to a list of x-coordinates and
y-coordinates of the polygons and Afghanistan is
handled fine. But once it gets to Angola it fails.
This is because Angola is not a single loop, it
consists of two disconnected closed-loop borders.

                I am wondering what a good way to handle this in

Bokeh might be. Does Bokeh have a preferred way, or
would it be best to just have Bokeh think in terms
of closed polygons? I have not found any precise
documentation for how Bokeh thinks about polygons.
Are polygons in Bokeh always required to be simple
closed curves, or are there ways to get around
that?

                For a country like Angola, one solution would be

to have multiple closed polygons (i.e. occupying two
elements in “source” in the Texas example linked to
above) and give both closed polygons links to the
same hover text.

                But for countries with cut-out regions (like

South Africa) is there a simple way to get Bokeh to
respect the actual polygonal structure given in a
GeoJSON file?

            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                 .

To view this discussion on the web visit


Sarah Bird
Developer, Bokeh

              [ ![Continuum
                  Analytics](https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000) ](http://continuum.io)

  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/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io.

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

          [https://groups.google.com/a/continuum.io/d/msgid/bokeh/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io)

https://groups.google.com/a/continuum.io/d/optout

Wow, thanks. Yeah, it’s a little choppy with this map. But it works.

Thanks, it looks like I’ll be able to do everything I was looking to do.

···

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:

You’ve got the right idea, but p atches takes xs and ys
not x and y. (This is the kind of
thin g that I’d hope you
don’t have to know in
the future for geo
support)

                    Here's it working: [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)





                      <img src="https://groups.google.com/a/continuum.io/group/bokeh/attach/145ca639fdeb40/bgagdadd.png?part=0.1.1&amp;authuser=0" style="max-height:300px;max-width:400px">





                                                  (it will take a

while to load be cause
that world map data is very la rge

  • I would suggest you consider going with
    a lower resolution one)

                                      Best,
    
    
    
                                        Bird
    

On 3/7/16 3:14 PM, Ryan Budney wrote:

Thanks Sarah,

      I did not know about the GeoJSON support.  My basic first

attempt went like this:

      import

bokeh as bk
import
json
from
bokeh.models import GeoJSONDataSource

      from bokeh.plotting import figure, show

      p=figure()

p.patches(x='x’y=,‘y’,source=GeoJSONDataSource(geojson=json.load(datafilename)))

      show(p)
      As I would eventually like to have mouse-over effects.  But

perhaps I misinterpreted your comment. The GeoJSON support is
perhaps only for things like x,y coordinates, it is not for
polygonal regions (patches)?

      On my first attempt, the i-python notebook freezes up, and

an error message appears. I can’t scroll down because the
window is frozen… Presumably I don’t understand the syntax
bokeh is looking for.

      datafilename is a geojsonfile, the 110m resolution map of

world country boundaries, from Natural Earth, converted to
geojson using the fiona library. I’ve attached a zip, as it’s
a rather large file.

-ryan

      On Monday, March 7, 2016 at 2:40:49 PM UTC-8, Sarah Bird > > wrote:

Hi Ryan,

              Thanks for your email, supporting countries like South Africa / Lesotho
          has been on my mind for nearly a year now, and as you can

see from the PR referenced .
Unfortunately its been more complicated than hoped

  • we need to pick a new interface and haven’t done so yet as other
    priorities have come along.

                              **HOWEVER****                                ,**                                  Bokeh
    

does no w
support G eoJSON
direct ly - have you tried just
putting in your GeoJSON and
seeing what you get out :
https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

                                                              If you share

your GeoJSON I can also try and help.

                                  Sincerely,



                                                                              Sarah

Bird

On 3/6/16 12:44 PM, [email protected] > > > wrote:

Greetings,

                I am doing an experiment with Bokeh for my class.

I would like to generate a world map with various
subvisions (countries, or perhaps regions in
countries) and have hover-text appear when the mouse
is over that region. So this is a choropleth map
with some interactivity.

                I am fairly certain this is do-able in Bokeh as I

have seen some similar tasks accomplished, but I am
curious how much effort it will take.

For example, http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

                does essentially what I would like to do.  Only

in a world map, some countries have multiple closed
polygons, and similarly some countries have cut-out
regions on the inside. So the Texas example is a
little bit too simple for my task.

                I downloaded my shape data (a by-country division

of the world) from Natural Earth and converted it to
GeoJSON data with Fiona.

                I follow the above Texas example, so I convert

the GeoJSON data to a list of x-coordinates and
y-coordinates of the polygons and Afghanistan is
handled fine. But once it gets to Angola it fails.
This is because Angola is not a single loop, it
consists of two disconnected closed-loop borders.

                I am wondering what a good way to handle this in

Bokeh might be. Does Bokeh have a preferred way, or
would it be best to just have Bokeh think in terms
of closed polygons? I have not found any precise
documentation for how Bokeh thinks about polygons.
Are polygons in Bokeh always required to be simple
closed curves, or are there ways to get around
that?

                For a country like Angola, one solution would be

to have multiple closed polygons (i.e. occupying two
elements in “source” in the Texas example linked to
above) and give both closed polygons links to the
same hover text.

                But for countries with cut-out regions (like

South Africa) is there a simple way to get Bokeh to
respect the actual polygonal structure given in a
GeoJSON file?

            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/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io)[https://groups.google.com/a/](https://groups.google.com/a/)continuum.io/d/msgid/bokeh/1f1441ef-40d7-4bfb-a042-47a17f045b84%40continuum.io.

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


Sarah Bird
Developer, Bokeh

              [ <img alt="Continuum
                  Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px"> ](http://continuum.io)

  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/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io?utm_medium=email&utm_source=footer)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/8cde7317-497d-42b1-9ff4-584a9f6f3a64%40continuum.io).

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


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px">
    ](http://continuum.io)

Sorry for asking so many questions, but is there a way to determine how patches is indexing the polygons, i.e. corresponding to the json file, so that I can tell Bokeh how to color each region? Similarly I would like to create some hover text for these regions. Does GeoJSONDataSource create a dictionary-type object, like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

I’ve tried adding a fill_color=[length 165 array of color strings] argument to the p.patches call but it does not seem to like that. 165 is the number of GeoJSON polygons in my world110.json file.

···

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:

You’ve got the right idea, but p atches takes xs and ys
not x and y. (This is the kind of
thin g that I’d hope you
don’t have to know in
the future for geo
support)

                    Here's it working: [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)

The easiest thing to do would be to add properties to your
geojson.

            You can see the example here:

@OrganisationName

                                              You could just as

easily have a property “color” and use th at color to color
your patches.

                            p.patches(xs='xs', ys='ys', fill_color='color')

                              Also                                     see

the user guide:

···

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your
experiences.

          Sincerely,

            Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

    Sorry for asking so many questions, but is there a

way to determine how patches is indexing the polygons, i.e.
corresponding to the json file, so that I can tell Bokeh how to
color each region? Similarly I would like to create some hover
text for these regions. Does GeoJSONDataSource create a
dictionary-type object, like in the texas
example:

  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/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

      I've tried adding a fill_color=[length 165 array of color

strings] argument to the p.patches call but it does not seem
to like that. 165 is the number of GeoJSON polygons in my
world110.json file.

      On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird

wrote:

You’ve got the right idea, but p atches takes
xs and ys not x and y. (This is the kind of thin g that I’d hope you
don’t have to know in the future for geo
support)

                              Here's it working: [](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=Truehttps://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io
https://groups.google.com/a/continuum.io/d/optout

"properties": {"scalerank": 1, "featurecla": "Admin-0 sovereignty", "labelrank": 3.0, "sovereignt": "Afghanistan", "sov_a3": "AFG", "adm0_dif": 0.0, "level": 2.0, "type": "Sovereign country", "admin": "Afghanistan", "adm0_a3": "AFG", "geou_dif": 0.0, "geounit": "Afghanistan", "gu_a3": "AFG", "su_dif": 0.0, "subunit": "Afghanistan", "su_a3": "AFG", "brk_diff": 0.0, "name": "Afghanistan", "name_long": "Afghanistan", "brk_a3": "AFG", "brk_name": "Afghanistan", "brk_group": null, "abbrev": "Afg.", "postal": "AF", "formal_en": "Islamic State of Afghanistan", "formal_fr": null, "note_adm0": null, "note_brk": null, "name_sort": "Afghanistan", "name_alt": null, "mapcolor7": 5.0, "mapcolor8": 6.0, "mapcolor9": 8.0, "mapcolor13": 7.0, "pop_est": 28400000.0, "gdp_md_est": 22270.0, "pop_year": -99.0, "lastcensus": 1979.0, "gdp_year": -99.0, "economy": "7. Least developed region", "income_grp": "5. Low income", "wikipedia": -99.0, "fips_10": null, "iso_a2": "AF", "iso_a3": "AFG"
, "iso_n3": "004", "un_a3": "004", "wb_a2": "AF", "wb_a3": "AFG", "woe_id": -99.0, "adm0_a3_is": "AFG", "adm0_a3_us": "AFG", "adm0_a3_un": -99.0, "adm0_a3_wb": -99.0, "continent": "Asia", "region_un": "Asia", "subregion": "Southern Asia", "region_wb": "South Asia", "name_len": 11.0, "long_len": 11.0, "abbrev_len": 4.0, "tiny": -99.0, "homepart": 1.0}
    See geojson spec:

.
T hat you
could use for hover immediately.

            Best,

              Bird
···

http://geojson.org/geojson-spec.html#examples

for understanding geojson pr operties

  • it’s pretty straight forward

Note your geojson that you sent already has a bunch of properties:
On 3/7/16 6:30 PM, Sarah Bird -
Continuum wrote:

The easiest thing to do would be to add properties
to your geojson.

                              You can see the example

here:
@OrganisationName

                                                  You could just as

easily have a property “color” and use th at color to color
your patches.

                              p.patches(xs='xs'                                    ,

ys=‘ys’ ,
fill_color=‘color’)

                                Also
                                  see

the user guide:


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your
experiences.

            Sincerely,

              Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

      Sorry for asking so many questions, but is there

a way to determine how patches is indexing the polygons, i.e.
corresponding to the json file, so that I can tell Bokeh how
to color each region? Similarly I would like to create some
hover text for these regions. Does GeoJSONDataSource create a
dictionary-type object, like in the texas example:

    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 .

For more options, visit .
http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

        I've tried adding a fill_color=[length 165 array of color

strings] argument to the p.patches call but it does not seem
to like that. 165 is the number of GeoJSON polygons in my
world110.json file.

        On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird

wrote:

You’ve got the right idea, but p atches
takes xs and ys not x and y. (This is the kind of thin g that I’d hope
you don’t have to know in the future for geo
support)

                                Here's it working:

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=Truehttps://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io
https://groups.google.com/a/continuum.io/d/optout


Sarah Bird
Developer, Bokeh

      [ ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png) ](http://continuum.io)

Ah! Thanks. I wasn’t certain if that was do-able or not. Apparently it’s okay. Thanks again. I’ll post a link to the completed project here once it’s done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I’ll try to make some pull requests to the documentation.

-ryan

···

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:

The easiest thing to do would be to add properties to your
geojson.

          You can see the example here:

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

            references a property from the GeoJSON

                  @OrganisationName



                                              You could just as

easily have a property “color” and use th at color to color
your patches.

                            p.patches(xs='xs', ys='ys', fill_color='color')



                              Also                                     see

the user guide:
http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

    Would really welcome pull requests to improve the               documentation based on your

experiences.

          Sincerely,



            Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

    Sorry for asking so many questions, but is there a

way to determine how patches is indexing the polygons, i.e.
corresponding to the json file, so that I can tell Bokeh how to
color each region? Similarly I would like to create some hover
text for these regions. Does GeoJSONDataSource create a
dictionary-type object, like in the texas
example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

      I've tried adding a fill_color=[length 165 array of color

strings] argument to the p.patches call but it does not seem
to like that. 165 is the number of GeoJSON polygons in my
world110.json file.

      On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird > > wrote:

You’ve got the right idea, but p atches takes
xs and ys not x and y. (This is the kind of thin g that I’d hope you
don’t have to know in the future for geo
support)

                              Here's it working: [](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)[http://nbviewer.jupyter.org/](http://nbviewer.jupyter.org/)github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

  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/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io?utm_medium=email&utm_source=footer)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io).

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


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px">
    ](http://continuum.io)

Just to chime in on a tangent, mailing list threads like this make my day. :slight_smile:

Thanks,

Bryan

···

On Mar 7, 2016, at 9:18 PM, Ryan Budney <[email protected]> wrote:

Ah! Thanks. I wasn't certain if that was do-able or not. Apparently it's okay. Thanks again. I'll post a link to the completed project here once it's done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I'll try to make some pull requests to the documentation.

Ryan,

If you got it all working in the end and can post the completed project, that will be great.

···

On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan Budney wrote:

Ah! Thanks. I wasn’t certain if that was do-able or not. Apparently it’s okay. Thanks again. I’ll post a link to the completed project here once it’s done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I’ll try to make some pull requests to the documentation.

-ryan

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:

The easiest thing to do would be to add properties to your
geojson.

          You can see the example here:

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

            references a property from the GeoJSON

                  @OrganisationName



                                              You could just as

easily have a property “color” and use th at color to color
your patches.

                            p.patches(xs='xs', ys='ys', fill_color='color')



                              Also                                     see

the user guide:
http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

    Would really welcome pull requests to improve the               documentation based on your

experiences.

          Sincerely,



            Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

    Sorry for asking so many questions, but is there a

way to determine how patches is indexing the polygons, i.e.
corresponding to the json file, so that I can tell Bokeh how to
color each region? Similarly I would like to create some hover
text for these regions. Does GeoJSONDataSource create a
dictionary-type object, like in the texas
example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

      I've tried adding a fill_color=[length 165 array of color

strings] argument to the p.patches call but it does not seem
to like that. 165 is the number of GeoJSON polygons in my
world110.json file.

      On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird > > > wrote:

You’ve got the right idea, but p atches takes
xs and ys not x and y. (This is the kind of thin g that I’d hope you
don’t have to know in the future for geo
support)

                              Here's it working: [](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)[http://nbviewer.jupyter.org/](http://nbviewer.jupyter.org/)github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

  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/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io?utm_medium=email&utm_source=footer)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io).

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


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px">
    ](http://continuum.io)

What version of Bokeh are you using?

Bryan

···

On Apr 17, 2016, at 10:58 PM, Linwood Creekmore III <[email protected]> wrote:

All:

I'm trying the same code here but just getting a blank screen using either inline plotting in a notebook or the html output file.

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

I even went back and tried the Texas example (http://bokeh.pydata.org/en/latest/docs/gallery/texas.html\) and get the blank screen and not output.

But, I do get the output notification: <Bokeh Notebook handle for In[11]>

Debug returned no traceback error.

Any ideas on how to fix? I want to do the same thing (make a map from geojson data).

On Thursday, April 14, 2016 at 12:14:30 PM UTC-4, ingles...@gmail.com wrote:
Ryan,

If you got it all working in the end and can post the completed project, that will be great.

On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan Budney wrote:
Ah! Thanks. I wasn't certain if that was do-able or not. Apparently it's okay. Thanks again. I'll post a link to the completed project here once it's done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I'll try to make some pull requests to the documentation.

-ryan

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:
The easiest thing to do would be to add properties to your geojson.

You can see the example here: https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON @OrganisationName

You could just as easily have a property "color" and use that color to color your patches.

p.patches(xs='xs', ys='ys', fill_color='color')

Also see the user guide: http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your experiences.

Sincerely,

Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

Sorry for asking so many questions, but is there a way to determine how patches is indexing the polygons, i.e. corresponding to the json file, so that I can tell Bokeh how to color each region? Similarly I would like to create some hover text for these regions. Does GeoJSONDataSource create a dictionary-type object, like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

I've tried adding a fill_color=[length 165 array of color strings] argument to the p.patches call but it does not seem to like that. 165 is the number of GeoJSON polygons in my world110.json file.

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:
You've got the right idea, but patches takes xs and ys not x and y. (This is the kind of thing that I'd hope you don't have to know in the future for geo support)

Here's it working: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
Sarah Bird
Developer, Bokeh

--
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/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I see you replied at the same time as me. Can you try installing the latest dev build, according to these instructions:

  <no title> — Bokeh 3.3.2 Documentation

There was a known, intermittent issue with outout in Jupyter notebooks. There was a proposed fix merged, but it is not in any full release yet, only on master, and in recent dev builds. Additionally, we had trouble reproducing this issue, so feedback from folks actually experiencing problems is valuable.

Thanks,

Bryan

···

On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven <[email protected]> wrote:

What version of Bokeh are you using?

Bryan

On Apr 17, 2016, at 10:58 PM, Linwood Creekmore III <[email protected]> wrote:

All:

I'm trying the same code here but just getting a blank screen using either inline plotting in a notebook or the html output file.

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

I even went back and tried the Texas example (http://bokeh.pydata.org/en/latest/docs/gallery/texas.html\) and get the blank screen and not output.

But, I do get the output notification: <Bokeh Notebook handle for In[11]>

Debug returned no traceback error.

Any ideas on how to fix? I want to do the same thing (make a map from geojson data).

On Thursday, April 14, 2016 at 12:14:30 PM UTC-4, ingles...@gmail.com wrote:
Ryan,

If you got it all working in the end and can post the completed project, that will be great.

On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan Budney wrote:
Ah! Thanks. I wasn't certain if that was do-able or not. Apparently it's okay. Thanks again. I'll post a link to the completed project here once it's done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I'll try to make some pull requests to the documentation.

-ryan

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:
The easiest thing to do would be to add properties to your geojson.

You can see the example here: https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON @OrganisationName

You could just as easily have a property "color" and use that color to color your patches.

p.patches(xs='xs', ys='ys', fill_color='color')

Also see the user guide: http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your experiences.

Sincerely,

Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

Sorry for asking so many questions, but is there a way to determine how patches is indexing the polygons, i.e. corresponding to the json file, so that I can tell Bokeh how to color each region? Similarly I would like to create some hover text for these regions. Does GeoJSONDataSource create a dictionary-type object, like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

I've tried adding a fill_color=[length 165 array of color strings] argument to the p.patches call but it does not seem to like that. 165 is the number of GeoJSON polygons in my world110.json file.

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:
You've got the right idea, but patches takes xs and ys not x and y. (This is the kind of thing that I'd hope you don't have to know in the future for geo support)

Here's it working: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
Sarah Bird
Developer, Bokeh

--
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/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Bryan:

I got it working. Good example I think. Hacked together this using info above from Sarah:

from bokeh.io import output_notebook, show

from bokeh.models import GeoJSONDataSource, HoverTool

from bokeh.plotting import figure

from bokeh.sampledata.sample_geojson import geojson

import requests

Notebook output

output_notebook()

From GitHub, a random geojson file; pulling the raw string using requests

r = requests.get(‘https://raw.githubusercontent.com/codeforamerica/click_that_hood/master/public/data/brazil-states.geojson’)

requests returns bytes, so decode and convert to string

brazilStates = r.content.decode()

Following Sarah Bird’s example from here

geojson = brazilStates

geo_source = GeoJSONDataSource(geojson=geojson)

from bokeh.plotting import figure

p = figure(height=900, width=900)

p.patches(xs=‘xs’, ys=‘ys’, fill_color = “#EBE02A”,fill_alpha=0.7, source=geo_source)

p.multi_line(xs=‘xs’, ys=‘ys’, line_color=‘white’, line_width=0.1, source=geo_source)

Getting the Hovertool, and adding State name as output

p.add_tools(HoverTool(tooltips=[(

“State”, “@name

)]))

output_file(“BrazilStates.html”, title=“BrazilStates.py example”)

show(p)

···

On Monday, April 18, 2016 at 12:45:29 AM UTC-4, Bryan Van de ven wrote:

I see you replied at the same time as me. Can you try installing the latest dev build, according to these instructions:

    [http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds](http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds)

There was a known, intermittent issue with outout in Jupyter notebooks. There was a proposed fix merged, but it is not in any full release yet, only on master, and in recent dev builds. Additionally, we had trouble reproducing this issue, so feedback from folks actually experiencing problems is valuable.

Thanks,

Bryan

On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven [email protected] wrote:

What version of Bokeh are you using?

Bryan

On Apr 17, 2016, at 10:58 PM, Linwood Creekmore III [email protected] wrote:

All:

I’m trying the same code here but just getting a blank screen using either inline plotting in a notebook or the html output file.

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

I even went back and tried the Texas example (http://bokeh.pydata.org/en/latest/docs/gallery/texas.html) and get the blank screen and not output.

But, I do get the output notification: <Bokeh Notebook handle for In[11]>

Debug returned no traceback error.

Any ideas on how to fix? I want to do the same thing (make a map from geojson data).

On Thursday, April 14, 2016 at 12:14:30 PM UTC-4, [email protected] wrote:

Ryan,

If you got it all working in the end and can post the completed project, that will be great.

On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan Budney wrote:

Ah! Thanks. I wasn’t certain if that was do-able or not. Apparently it’s okay. Thanks again. I’ll post a link to the completed project here once it’s done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I’ll try to make some pull requests to the documentation.

-ryan

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:

The easiest thing to do would be to add properties to your geojson.

You can see the example here: https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON @OrganisationName

You could just as easily have a property “color” and use that color to color your patches.

p.patches(xs=‘xs’, ys=‘ys’, fill_color=‘color’)

Also see the user guide: http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your experiences.

Sincerely,

Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

Sorry for asking so many questions, but is there a way to determine how patches is indexing the polygons, i.e. corresponding to the json file, so that I can tell Bokeh how to color each region? Similarly I would like to create some hover text for these regions. Does GeoJSONDataSource create a dictionary-type object, like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

I’ve tried adding a fill_color=[length 165 array of color strings] argument to the p.patches call but it does not seem to like that. 165 is the number of GeoJSON polygons in my world110.json file.

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:

You’ve got the right idea, but patches takes xs and ys not x and y. (This is the kind of thing that I’d hope you don’t have to know in the future for geo support)

Here’s it working: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True


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/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io.

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


Sarah Bird

Developer, Bokeh


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/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io.

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

Bryan:

I’m sorry. I was deleting replies because I thought I was having the issue because of operator error on my behalf.

But, I had the issue with Bokeh 0.11.0 and 0.11.1 (did conda uninstall and installs of both).

For some reason, it started working after a fresh install (I shared the code and a geojson I found on github). It’s very choppy, any reason why? It still looks great!!!

I’m on a MacBook Pro (13-inch, Mid 2012), OS X El Capitan 10.11.4.

Let me know if I can give any other info to help.

···

On Monday, April 18, 2016 at 12:45:29 AM UTC-4, Bryan Van de ven wrote:

I see you replied at the same time as me. Can you try installing the latest dev build, according to these instructions:

    [http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds](http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds)

There was a known, intermittent issue with outout in Jupyter notebooks. There was a proposed fix merged, but it is not in any full release yet, only on master, and in recent dev builds. Additionally, we had trouble reproducing this issue, so feedback from folks actually experiencing problems is valuable.

Thanks,

Bryan

On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven [email protected] wrote:

What version of Bokeh are you using?

Bryan

On Apr 17, 2016, at 10:58 PM, Linwood Creekmore III [email protected] wrote:

All:

I’m trying the same code here but just getting a blank screen using either inline plotting in a notebook or the html output file.

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

I even went back and tried the Texas example (http://bokeh.pydata.org/en/latest/docs/gallery/texas.html) and get the blank screen and not output.

But, I do get the output notification: <Bokeh Notebook handle for In[11]>

Debug returned no traceback error.

Any ideas on how to fix? I want to do the same thing (make a map from geojson data).

On Thursday, April 14, 2016 at 12:14:30 PM UTC-4, [email protected] wrote:

Ryan,

If you got it all working in the end and can post the completed project, that will be great.

On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan Budney wrote:

Ah! Thanks. I wasn’t certain if that was do-able or not. Apparently it’s okay. Thanks again. I’ll post a link to the completed project here once it’s done, so that others can hopefully gain something from the example.

Once I have a better understanding of these objects I’ll try to make some pull requests to the documentation.

-ryan

On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah Bird wrote:

The easiest thing to do would be to add properties to your geojson.

You can see the example here: https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.py

references a property from the GeoJSON @OrganisationName

You could just as easily have a property “color” and use that color to color your patches.

p.patches(xs=‘xs’, ys=‘ys’, fill_color=‘color’)

Also see the user guide: http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html

Would really welcome pull requests to improve the documentation based on your experiences.

Sincerely,

Sarah Bird

On 3/7/16 5:45 PM, Ryan Budney wrote:

Sorry for asking so many questions, but is there a way to determine how patches is indexing the polygons, i.e. corresponding to the json file, so that I can tell Bokeh how to color each region? Similarly I would like to create some hover text for these regions. Does GeoJSONDataSource create a dictionary-type object, like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

I’ve tried adding a fill_color=[length 165 array of color strings] argument to the p.patches call but it does not seem to like that. 165 is the number of GeoJSON polygons in my world110.json file.

On Monday, March 7, 2016 at 4:27:20 PM UTC-8, Sarah Bird wrote:

You’ve got the right idea, but patches takes xs and ys not x and y. (This is the kind of thing that I’d hope you don’t have to know in the future for geo support)

Here’s it working: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True


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/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io.

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


Sarah Bird

Developer, Bokeh


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/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io.

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

HI Linwood,

    I took                 a

look - looks great - I see the choppiness on pan - is that what you mean?

                            The choppiness is bec                                        ause your

brazil file is 2MB. Th at’s a
lot to re-render on pan.

                                        I would suggest using a

simplified ge ojson.
Natural earth pro vides
datasets at different
resolutions. There are
also lots of libraries
that will simplify
geographic boundaries.

                                              Good luck.

                                                  Bird
···

On 4/18/16 12:31 AM, Linwood Creekmore
III wrote:

Bryan:

    I'm sorry.  I was deleting replies because I thought I was

having the issue because of operator error on my behalf.

      But, I had the issue with Bokeh 0.11.0 and 0.11.1 (did

conda uninstall and installs of both).

      For some reason, it started working after a fresh install

(I shared the code and a geojson I found on github). It’s
very choppy, any reason why? It still looks great!!!

      I'm on a MacBook Pro (13-inch, Mid 2012), OS X El Capitan

10.11.4.

Let me know if I can give any other info to help.

      On Monday, April 18, 2016 at 12:45:29 AM UTC-4, Bryan Van de

ven wrote:

        I see

you replied at the same time as me. Can you try installing
the latest dev build, according to these instructions:

                [http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds](http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds)




        There was a known, intermittent issue with outout in Jupyter

notebooks. There was a proposed fix merged, but it is not in
any full release yet, only on master, and in recent dev
builds. Additionally, we had trouble reproducing this issue,
so feedback from folks actually experiencing problems is
valuable.

        Thanks,




        Bryan



        > On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven <            >

wrote:

What version of Bokeh are you using?
Bryan > >> On Apr 17, 2016, at 10:58 PM, Linwood Creekmore III
<>
wrote:

All:
I’m trying the same code here but just getting a
blank screen using either inline plotting in a notebook or
the html output file.

I even went back and tried the Texas example (

  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/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected]

[email protected]

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

http://bokeh.pydata.org/en/latest/docs/gallery/texas.html )
and get the blank screen and not output.

        >>

        >> But, I do get the output notification: <Bokeh

Notebook handle for In[11]>

        >>

        >>

        >> Debug returned no traceback error.  

        >>

        >> Any ideas on how to fix?  I want to do the same

thing (make a map from geojson data).

        >>

        >>

        >> On Thursday, April 14, 2016 at 12:14:30 PM UTC-4,  wrote:

Ryan,

If you got it all working in the end and can post
the completed project, that will be great.
On Monday, March 7, 2016 at 9:18:49 PM UTC-6, Ryan
Budney wrote:
Ah! Thanks. I wasn’t certain if that was do-able
or not. Apparently it’s okay. Thanks again. I’ll post a
link to the completed project here once it’s done, so that
others can hopefully gain something from the example. >> >> Once I have a better understanding of these objects
I’ll try to make some pull requests to the documentation. >> >> -ryan
On Monday, March 7, 2016 at 6:30:26 PM UTC-8, Sarah
Bird wrote:
The easiest thing to do would be to add properties
to your geojson.
You can see the example here: [email protected]

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points. py

        >>

        >> references a property from the GeoJSON

@OrganisationName

        >>

        >> You could just as easily have a property "color"

and use that color to color your patches.

        >>

        >> p.patches(xs='xs', ys='ys', fill_color='color')

        >>

        >> Also see the user guide: [http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html](http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html)

        >>

        >> Would really welcome pull requests to improve the

documentation based on your experiences.

        >>

        >> Sincerely,

        >>

        >> Sarah Bird

        >>

        >> On 3/7/16 5:45 PM, Ryan Budney wrote:

        >>> Sorry for asking so many questions, but is

there a way to determine how patches is indexing the
polygons, i.e. corresponding to the json file, so that I can
tell Bokeh how to color each region? Similarly I would like
to create some hover text for these regions. Does
GeoJSONDataSource create a dictionary-type object, like in
the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

        >>>

        >>> I've tried adding a fill_color=[length 165

array of color strings] argument to the p.patches call but
it does not seem to like that. 165 is the number of GeoJSON
polygons in my world110.json file.

        >>>

        >>> On Monday, March 7, 2016 at 4:27:20 PM UTC-8,

Sarah Bird wrote:

        >>> You've got the right idea, but patches takes xs

and ys not x and y. (This is the kind of thing that I’d hope
you don’t have to know in the future for geo support)

        >>>

        >>> Here's it working: [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)

        >>>

        >>> --

        >>> 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
.

To post to this group, send email to .
To view this discussion on the web visit [email protected]
[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e- 3ebc29cd1911%40continuum.io.

        >>> For more options, visit [](https://groups.google.com/a/continuum.io/d/optout)[https://groups.google.com/a/](https://groups.google.com/a/)            continuum.io/d/optout.

        >>

        >> --

        >> Sarah Bird

        >> Developer, Bokeh

        >>

        >>

        >>

        >>

        >> --

        >> 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
        .

To view this discussion on the web visit [email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/81aaea0a-1a80-4693-88a5- fe89c2aefecf%40continuum.io.

        >> For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout)            .

        >

      [https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io)

https://groups.google.com/a/continuum.io/d/optout

Hi again,

    OK So there is a fix you can make:                                                           p =

figure(height=900,
width=900,
lod_threshold=1)

                                                                                                                And then
                                                      check

out the other
lod stuff
here:

                lod

normally only kicks in at ~100 ( i think ) points
(you only have a handful
of brazillian states)

              Normally lod picks 10% of points and t                  his

lets the user have context while they’re panning, while letting us redraw very quickly so everything
feels smooth.

                The problem is that it doesn't work well for data like you have - because it's                                           picking

out one patch ( state)
at a time, not
1 in 10 of
the boundary
points that make up a state.

                                                                                              If you

try the above
code you’ll at least
see lod in
action - you’ll
only see a couple
of gray states
while you pan.

                                                      Best,

                                                      Bird
···

http://bokeh.pydata.org/en/0.11.1/docs/user_guide/tools.html#controlling-level-of-detail
On 4/19/16 5:31 PM, Sarah Bird -
Continuum wrote:

HI Linwood,

      I took                   a

look - looks great - I see the choppiness on pan - is that wha t
you mean?

                              The choppiness is bec                                          ause

your brazil file is 2MB. Th at’s
a lot to re-render on pan.

                                          I would suggest using a

simplified ge
ojson.
Natural earth pro
vides
datasets at different
resolutions. There are
also lots of libraries
that will simplify
geographic boundaries.

                                                Good luck.



                                                    Bird


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

    On 4/18/16 12:31 AM, Linwood

Creekmore III wrote:

Bryan:

      I'm sorry.  I was deleting replies because I thought I was

having the issue because of operator error on my behalf.

        But, I had the issue with Bokeh 0.11.0 and 0.11.1 (did

conda uninstall and installs of both).

        For some reason, it started working after a fresh install

(I shared the code and a geojson I found on github). It’s
very choppy, any reason why? It still looks great!!!

        I'm on a MacBook Pro (13-inch, Mid 2012), OS X El Capitan

10.11.4.

Let me know if I can give any other info to help.

        On Monday, April 18, 2016 at 12:45:29 AM UTC-4, Bryan Van de

ven wrote:

          I see you replied at the same

time as me. Can you try installing the latest dev build,
according to these instructions:

                  [http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds](http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds)




          There was a known, intermittent issue with outout in

Jupyter notebooks. There was a proposed fix merged, but it
is not in any full release yet, only on master, and in
recent dev builds. Additionally, we had trouble
reproducing this issue, so feedback from folks actually
experiencing problems is valuable.

          Thanks,



          Bryan



          > On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven <>

wrote: > > What version of Bokeh are you using? > > Bryan > >> On Apr 17, 2016, at 10:58 PM, Linwood Creekmore
III <>
wrote: >> >> All: >> >> I’m trying the same code here but just getting a
blank screen using either inline plotting in a notebook or
the html output file. >> >> >> >> I even went back and tried the Texas example (

    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 .

For more options, visit .
[email protected]

[email protected]

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True

http://bokeh.pydata.org/en/latest/docs/gallery/texas.html )
and get the blank screen and not output.

          >>

          >> But, I do get the output notification: <Bokeh

Notebook handle for In[11]>

          >>

          >>

          >> Debug returned no traceback error.  

          >>

          >> Any ideas on how to fix?  I want to do the same

thing (make a map from geojson data).

          >>

          >>

          >> On Thursday, April 14, 2016 at 12:14:30 PM UTC-4,

wrote: >> Ryan, >> >> If you got it all working in the end and can post
the completed project, that will be great. >> >> On Monday, March 7, 2016 at 9:18:49 PM UTC-6,
Ryan Budney wrote: >> Ah! Thanks. I wasn’t certain if that was
do-able or not. Apparently it’s okay. Thanks again.
I’ll post a link to the completed project here once it’s
done, so that others can hopefully gain something from the
example. >> >> Once I have a better understanding of these
objects I’ll try to make some pull requests to the
documentation. >> >> -ryan >> >> On Monday, March 7, 2016 at 6:30:26 PM UTC-8,
Sarah Bird wrote: >> The easiest thing to do would be to add
properties to your geojson. >> >> You can see the example here: [email protected]

https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/geojson_points.
py

          >>

          >> references a property from the GeoJSON

@OrganisationName

          >>

          >> You could just as easily have a property "color"

and use that color to color your patches.

          >>

          >> p.patches(xs='xs', ys='ys', fill_color='color')

          >>

          >> Also see the user guide: [](http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html)[http://bokeh.pydata.org/en/](http://bokeh.pydata.org/en/)latest/docs/user_guide/geo.              html

          >>

          >> Would really welcome pull requests to improve the

documentation based on your experiences.

          >>

          >> Sincerely,

          >>

          >> Sarah Bird

          >>

          >> On 3/7/16 5:45 PM, Ryan Budney wrote:

          >>> Sorry for asking so many questions, but is

there a way to determine how patches is indexing the
polygons, i.e. corresponding to the json file, so that I
can tell Bokeh how to color each region? Similarly I
would like to create some hover text for these regions.
Does GeoJSONDataSource create a dictionary-type object,
like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

          >>>

          >>> I've tried adding a fill_color=[length 165

array of color strings] argument to the p.patches call but
it does not seem to like that. 165 is the number of
GeoJSON polygons in my world110.json file.

          >>>

          >>> On Monday, March 7, 2016 at 4:27:20 PM UTC-8,

Sarah Bird wrote:

          >>> You've got the right idea, but patches takes

xs and ys not x and y. (This is the kind of thing that I’d
hope you don’t have to know in the future for geo support)

          >>>

          >>> Here's it working: [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)

          >>>

          >>> --

          >>> 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 .

To post to this group, send email to .
To view this discussion on the web visit [email protected]
[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-
3ebc29cd1911%40continuum.io.

          >>> For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)
          continuum.io/d/optout.

          >>

          >> --

          >> Sarah Bird

          >> Developer, Bokeh

          >>

          >>

          >>

          >>

          >> --

          >> 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 .

To view this discussion on the web visit [email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/81aaea0a-1a80-4693-88a5-
fe89c2aefecf%40continuum.io.

          >> For more options, visit [](https://groups.google.com/a/continuum.io/d/optout)[https://groups.google.com/a/](https://groups.google.com/a/)              continuum.io/d/optout.

          >

        [](https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io)

https://groups.google.com/a/continuum.io/d/optout


Sarah Bird
Developer, Bokeh

      [ ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png) ](http://continuum.io)

Sarah:

The refresh is much faster! Thanks a bunch.

···

On Tuesday, April 19, 2016 at 6:49:34 PM UTC-4, Sarah Bird wrote:

Hi again,

    OK So there is a fix you can make:                                                           p =

figure(height=900,
width=900,
lod_threshold=1)

                                                                                                                And then
                                                      check

out the other
lod stuff
here:
http://bokeh.pydata.org/en/0.11.1/docs/user_guide/tools.html#controlling-level-of-detail

                lod

normally only kicks in at ~100 ( i think ) points
(you only have a handful
of brazillian states)

              Normally lod picks 10% of points and t                  his

lets the user have context while they’re panning, while letting us redraw very quickly so everything
feels smooth.

                The problem is that it doesn't work well for data like you have - because it's                                           picking

out one patch ( state)
at a time, not
1 in 10 of
the boundary
points that make up a state.

                                                                                              If you

try the above
code you’ll at least
see lod in
action - you’ll
only see a couple
of gray states
while you pan.

                                                      Best,



                                                      Bird


  On 4/19/16 5:31 PM, Sarah Bird - > Continuum wrote:

HI Linwood,

      I took                   a

look - looks great - I see the choppiness on pan - is that wha t
you mean?

                              The choppiness is bec                                          ause

your brazil file is 2MB. Th at’s
a lot to re-render on pan.

                                          I would suggest using a

simplified ge
ojson.
Natural earth pro
vides
datasets at different
resolutions. There are
also lots of libraries
that will simplify
geographic boundaries.

                                                Good luck.



                                                    Bird


    On 4/18/16 12:31 AM, Linwood > > Creekmore III wrote:

Bryan:

      I'm sorry.  I was deleting replies because I thought I was

having the issue because of operator error on my behalf.

        But, I had the issue with Bokeh 0.11.0 and 0.11.1 (did

conda uninstall and installs of both).

        For some reason, it started working after a fresh install

(I shared the code and a geojson I found on github). It’s
very choppy, any reason why? It still looks great!!!

        I'm on a MacBook Pro (13-inch, Mid 2012), OS X El Capitan

10.11.4.

Let me know if I can give any other info to help.

        On Monday, April 18, 2016 at 12:45:29 AM UTC-4, Bryan Van de > > > ven wrote:
          I see you replied at the same

time as me. Can you try installing the latest dev build,
according to these instructions:

                  [http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds](http://bokeh.pydata.org/en/latest/docs/installation.html#developer-builds)




          There was a known, intermittent issue with outout in

Jupyter notebooks. There was a proposed fix merged, but it
is not in any full release yet, only on master, and in
recent dev builds. Additionally, we had trouble
reproducing this issue, so feedback from folks actually
experiencing problems is valuable.

          Thanks,



          Bryan



          > On Apr 17, 2016, at 11:42 PM, Bryan Van de Ven <[email protected] > > > >               > > > > > wrote:

          >

          > What version of Bokeh are you using?

          >

          > Bryan

          >

          >> On Apr 17, 2016, at 10:58 PM, Linwood Creekmore > > > > III <[email protected] > > > >               > > > > > wrote:

          >>

          >> All:

          >>

          >> I'm trying the same code here but just getting a

blank screen using either inline plotting in a notebook or
the html output file.

          >>

          >> [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)


          >>

          >> I even went back and tried the Texas example ([](http://bokeh.pydata.org/en/)[http://bokeh.pydata.org/en/](http://bokeh.pydata.org/en/)la              test/docs/gallery/texas.html)

and get the blank screen and not output.

          >>

          >> But, I do get the output notification: <Bokeh

Notebook handle for In[11]>

          >>

          >>

          >> Debug returned no traceback error.  

          >>

          >> Any ideas on how to fix?  I want to do the same

thing (make a map from geojson data).

          >>

          >>

          >> On Thursday, April 14, 2016 at 12:14:30 PM UTC-4, > > > > [email protected] > > > >               wrote:

          >> Ryan,

          >>

          >> If you got it all working in the end and can post

the completed project, that will be great.

          >>

          >> On Monday, March 7, 2016 at 9:18:49 PM UTC-6, > > > > Ryan Budney wrote:

          >> Ah!  Thanks.  I wasn't certain if that was

do-able or not. Apparently it’s okay. Thanks again.
I’ll post a link to the completed project here once it’s
done, so that others can hopefully gain something from the
example.

          >>

          >> Once I have a better understanding of these

objects I’ll try to make some pull requests to the
documentation.

          >>

          >> -ryan

          >>

          >> On Monday, March 7, 2016 at 6:30:26 PM UTC-8, > > > > Sarah Bird wrote:

          >> The easiest thing to do would be to add

properties to your geojson.

          >>

          >> You can see the example here: [](https://github.com/bokeh/)[https://github.com/bokeh/](https://github.com/bokeh/)bokeh/blob/master/examples/plotting/file/geojson_points.
          py


          >>

          >> references a property from the GeoJSON

@OrganisationName

          >>

          >> You could just as easily have a property "color"

and use that color to color your patches.

          >>

          >> p.patches(xs='xs', ys='ys', fill_color='color')

          >>

          >> Also see the user guide: [](http://bokeh.pydata.org/en/latest/docs/user_guide/geo.html)[http://bokeh.pydata.org/en/](http://bokeh.pydata.org/en/)lat              est/docs/user_guide/geo.html


          >>

          >> Would really welcome pull requests to improve the

documentation based on your experiences.

          >>

          >> Sincerely,

          >>

          >> Sarah Bird

          >>

          >> On 3/7/16 5:45 PM, Ryan Budney wrote:

          >>> Sorry for asking so many questions, but is

there a way to determine how patches is indexing the
polygons, i.e. corresponding to the json file, so that I
can tell Bokeh how to color each region? Similarly I
would like to create some hover text for these regions.
Does GeoJSONDataSource create a dictionary-type object,
like in the texas example: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

          >>>

          >>> I've tried adding a fill_color=[length 165

array of color strings] argument to the p.patches call but
it does not seem to like that. 165 is the number of
GeoJSON polygons in my world110.json file.

          >>>

          >>> On Monday, March 7, 2016 at 4:27:20 PM UTC-8, > > > > Sarah Bird wrote:

          >>> You've got the right idea, but patches takes

xs and ys not x and y. (This is the kind of thing that I’d
hope you don’t have to know in the future for geo support)

          >>>

          >>> Here's it working: [http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True](http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/world%20map/world%20map%20geojson.ipynb?flush_cache=True)


          >>>

          >>> --

          >>> 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/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io](http://continuum.io/d/msgid/bokeh/6aff57c0-6002-4313-853e-3ebc29cd1911%40continuum.io)
          .


          >>> For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/optout](http://continuum.io/d/optout)
          .


          >>

          >> --

          >> Sarah Bird

          >> Developer, Bokeh

          >>

          >>

          >>

          >>

          >> --

          >> 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/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io](http://continuum.io/d/msgid/bokeh/81aaea0a-1a80-4693-88a5-fe89c2aefecf%40continuum.io)
          .


          >> For more options, visit [](https://groups.google.com/a/continuum.io/d/optout)[https://groups.google.com/a/](https://groups.google.com/a/)co              ntinuum.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/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/d816b689-bf31-4262-8471-a3c0ce365a9b%40continuum.io).

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


Sarah Bird
Developer, Bokeh

      [ <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px"> ](http://continuum.io)


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" height="30px" width="150px">
    ](http://continuum.io)