☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Unable to plot data on map correctly

Community Support
EM1
EM1

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?
⌁   Link to post
Tyler_Nickerson
Tyler_Nickerson

The piece that is missing here is map projections. Your points don’t match up with the tiles because they are not scaled to the same projection as the bokeh map tiles, which use Web Mercator projection. Pyproj is a simple but, effective module for working with different projections. You’ll need to know the ESPG codes of the projections you converting your coordinates to and from, they can often be found by googling “espg [projection name]”; here is what I found looking for Web Mercator and longitude and latitude.

···

On Thu, Feb 9, 2017 at 5:26 PM, EM ericmajinglong@gmail.com wrote:

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io.

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

⌁   Link to post
EM1
EM1

Big thanks, Tyler! I’m almost there - is there any documentation on what the EPSG code of the Stamen and CartoDB tiles are? I can’t seem to find them even via Google.

···

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 12:01 am, Tyler Nickerson <tylerjnickerson@gmail.com> wrote:

The piece that is missing here is map projections. Your points don’t match up with the tiles because they are not scaled to the same projection as the bokeh map tiles, which use Web Mercator projection. Pyproj is a simple but, effective module for working with different projections. You’ll need to know the ESPG codes of the projections you converting your coordinates to and from, they can often be found by googling “espg [projection name]”; here is what I found looking for Web Mercator and longitude and latitude.

On Thu, Feb 9, 2017 at 5:26 PM, EM ericmajinglong@gmail.com wrote:

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io.

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

–

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/CSa9CwByMc0/unsubscribe.

To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com.

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

⌁   Link to post
EM1
EM1

I’m sorry, I’m an ignorant fool for not reading your email carefully. I clicked on the link and saw what I think is correct!

···

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 9:50 am, Eric Ma <ericmajinglong@gmail.com> wrote:

Big thanks, Tyler! I’m almost there - is there any documentation on what the EPSG code of the Stamen and CartoDB tiles are? I can’t seem to find them even via Google.

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 12:01 am, Tyler Nickerson <tylerjnickerson@gmail.com> wrote:

The piece that is missing here is map projections. Your points don’t match up with the tiles because they are not scaled to the same projection as the bokeh map tiles, which use Web Mercator projection. Pyproj is a simple but, effective module for working with different projections. You’ll need to know the ESPG codes of the projections you converting your coordinates to and from, they can often be found by googling “espg [projection name]”; here is what I found looking for Web Mercator and longitude and latitude.

On Thu, Feb 9, 2017 at 5:26 PM, EM ericmajinglong@gmail.com wrote:

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io.

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

–

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/CSa9CwByMc0/unsubscribe.

To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com.

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

⌁   Link to post
EM1
EM1

Hmm… this is interesting. I tried the Web Mercator projection, which supposedly is the correct coordinate system for the Stamen maps, but my transformed coordinates are still incorrect.

The Boston dataset’s EPSG code is EPSG:2249 (I checked with the City of Boston). Are the Stamen tiles definitely EPSG:3857?

···

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 9:52 am, Eric Ma <ericmajinglong@gmail.com> wrote:

I’m sorry, I’m an ignorant fool for not reading your email carefully. I clicked on the link and saw what I think is correct!

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 9:50 am, Eric Ma <ericmajinglong@gmail.com> wrote:

Big thanks, Tyler! I’m almost there - is there any documentation on what the EPSG code of the Stamen and CartoDB tiles are? I can’t seem to find them even via Google.

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 12:01 am, Tyler Nickerson <tylerjnickerson@gmail.com> wrote:

The piece that is missing here is map projections. Your points don’t match up with the tiles because they are not scaled to the same projection as the bokeh map tiles, which use Web Mercator projection. Pyproj is a simple but, effective module for working with different projections. You’ll need to know the ESPG codes of the projections you converting your coordinates to and from, they can often be found by googling “espg [projection name]”; here is what I found looking for Web Mercator and longitude and latitude.

On Thu, Feb 9, 2017 at 5:26 PM, EM ericmajinglong@gmail.com wrote:

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io.

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

–

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/CSa9CwByMc0/unsubscribe.

To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com.

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

⌁   Link to post
EM1
EM1

It seems like my data source had the EPSG code done wrong. My apologies for spamming the mailing list!

···

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 10:07 am, Eric Ma <ericmajinglong@gmail.com> wrote:

Hmm… this is interesting. I tried the Web Mercator projection, which supposedly is the correct coordinate system for the Stamen maps, but my transformed coordinates are still incorrect.

The Boston dataset’s EPSG code is EPSG:2249 (I checked with the City of Boston). Are the Stamen tiles definitely EPSG:3857?

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 9:52 am, Eric Ma <ericmajinglong@gmail.com> wrote:

I’m sorry, I’m an ignorant fool for not reading your email carefully. I clicked on the link and saw what I think is correct!

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 9:50 am, Eric Ma <ericmajinglong@gmail.com> wrote:

Big thanks, Tyler! I’m almost there - is there any documentation on what the EPSG code of the Stamen and CartoDB tiles are? I can’t seem to find them even via Google.

Sent from Nylas Mail, the best free email app for work

        On Feb 10 2017, at 12:01 am, Tyler Nickerson <tylerjnickerson@gmail.com> wrote:

The piece that is missing here is map projections. Your points don’t match up with the tiles because they are not scaled to the same projection as the bokeh map tiles, which use Web Mercator projection. Pyproj is a simple but, effective module for working with different projections. You’ll need to know the ESPG codes of the projections you converting your coordinates to and from, they can often be found by googling “espg [projection name]”; here is what I found looking for Web Mercator and longitude and latitude.

On Thu, Feb 9, 2017 at 5:26 PM, EM ericmajinglong@gmail.com wrote:

I’ve encountered an issue with plotting map data, and I’m not quite sure what I’m doing wrong here.

Here’s a fairly self-contained example of what I’m trying to do:

import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Circle
from bokeh.plotting import figure, show

sprays = pd.read_csv(‘http://bostonopendata-boston.opendata.arcgis.com/datasets/5409b7735d384798b2a360aa47c9b128_0.csv’)
sprays.head()

src = ColumnDataSource(sprays)

x_range = Range1d(start=-20E6, end=20E6, bounds=None)
y_range = Range1d(start=-20E6, end=20E6, bounds=None)

p = figure(x_range=x_range, y_range=y_range)
p.axis.visible = False
circs = Circle(x=‘X’, y=‘Y’, size=10, line_color=None, fill_alpha=0.8, fill_color=“blue”, )
p.add_glyph(src, circs)
p.add_tile(STAMEN_TONER)

show(p)

``

The problems I’m encountering are as follows:

  1. The data points are not aligned on the correct portion of the map; they all show up near the equator, near a “null island”. These are all data points from Boston, so I though they would automatically line up on Boston when I add the stamen toner tile, but I must be missing something here.
  2. If I take out x_range and y_range from the figure constructor, then the STAMEN_TONER tile doesn’t show up on the figure. I can clearly see that the data points are plotted correctly relative to one another.
    I think I might need some educating here - what’s missing from my mental model of Bokeh’s underpinnings? Also, what’s the right thing to do to get the data points mapped onto Boston?

–

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+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io.

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

–

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/CSa9CwByMc0/unsubscribe.

To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com.

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

⌁   Link to post

End of archived discussion · Replies are disabled