# Unable to plot data on map correctly

**URL:** <https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956>\
**Category:** Community Support\
**Created:** [February 10, 2017, 1:26am UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956 "2017-02-10T01:26:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EM1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/f6c823/32.png) [@EM1](https://discourse.bokeh.org/u/EM1)\
**Post date:** [February 10, 2017, 1:26am UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/1 "2017-02-10T01:26:57Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![Tyler\_Nickerson](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/t/258eb7/32.png) [@Tyler\_Nickerson](https://discourse.bokeh.org/u/Tyler_Nickerson)\
**Post date:** [February 10, 2017, 5:01am UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/2 "2017-02-10T05:01:07Z")

</div>

The piece that is missing here is [map projections](https://en.wikipedia.org/wiki/Map_projection). 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](http://jswhit.github.io/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](http://spatialreference.org/ref/sr-org/7483/) and [longitude and latitude](http://spatialreference.org/ref/epsg/wgs-84/).

> **···**
>
> On Thu, Feb 9, 2017 at 5:26 PM, EM [ericmajinglong@gmail.com](mailto: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](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](mailto:bokeh+unsubscribe@continuum.io).
> > 
> > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io?utm_medium=email&utm_source=footer).
> > 
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

---

<div class="post-metadata">

**Author:** ![EM1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/f6c823/32.png) [@EM1](https://discourse.bokeh.org/u/EM1)\
**Post date:** [February 10, 2017, 2:50pm UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/3 "2017-02-10T14:50:07Z")

</div>

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](https://n1.nylas.com/link/5859fa3f4f6b56cb88201b697de6435a0281d0c3f95847c4ab56f2c09f4b89bf/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://en.wikipedia.org/wiki/Map_projection). 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](http://jswhit.github.io/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](http://spatialreference.org/ref/sr-org/7483/) and [longitude and latitude](http://spatialreference.org/ref/epsg/wgs-84/).
> 
> > On Thu, Feb 9, 2017 at 5:26 PM, EM [ericmajinglong@gmail.com](mailto: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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > 
> > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io?utm_medium=email&utm_source=footer).
> > > 
> > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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](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](mailto:bokeh+unsubscribe@continuum.io).
> > 
> > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com?utm_medium=email&utm_source=footer).
> > 
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

---

<div class="post-metadata">

**Author:** ![EM1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/f6c823/32.png) [@EM1](https://discourse.bokeh.org/u/EM1)\
**Post date:** [February 10, 2017, 2:52pm UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/4 "2017-02-10T14:52:05Z")

</div>

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](https://n1.nylas.com/link/0aeb88aa80e6c5ae3e15f4bd3203e5fd7e0bd29c619b476252a26329aae25668/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/5859fa3f4f6b56cb88201b697de6435a0281d0c3f95847c4ab56f2c09f4b89bf/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://en.wikipedia.org/wiki/Map_projection). 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](http://jswhit.github.io/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](http://spatialreference.org/ref/sr-org/7483/) and [longitude and latitude](http://spatialreference.org/ref/epsg/wgs-84/).
> 
> > > On Thu, Feb 9, 2017 at 5:26 PM, EM [ericmajinglong@gmail.com](mailto: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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > > 
> > > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io?utm_medium=email&utm_source=footer).
> > > > 
> > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > 
> > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com?utm_medium=email&utm_source=footer).
> > > 
> > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

---

<div class="post-metadata">

**Author:** ![EM1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/f6c823/32.png) [@EM1](https://discourse.bokeh.org/u/EM1)\
**Post date:** [February 10, 2017, 3:07pm UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/5 "2017-02-10T15:07:08Z")

</div>

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](https://n1.nylas.com/link/a0c84705db99d1926a598dfd390181e126fdc76e5d0e6602c207207048f26367/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/0aeb88aa80e6c5ae3e15f4bd3203e5fd7e0bd29c619b476252a26329aae25668/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/5859fa3f4f6b56cb88201b697de6435a0281d0c3f95847c4ab56f2c09f4b89bf/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://en.wikipedia.org/wiki/Map_projection). 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](http://jswhit.github.io/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](http://spatialreference.org/ref/sr-org/7483/) and [longitude and latitude](http://spatialreference.org/ref/epsg/wgs-84/).
> 
> > > > On Thu, Feb 9, 2017 at 5:26 PM, EM [ericmajinglong@gmail.com](mailto: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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > > > 
> > > > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io?utm_medium=email&utm_source=footer).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > > 
> > > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com?utm_medium=email&utm_source=footer).
> > > > 
> > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

---

<div class="post-metadata">

**Author:** ![EM1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/f6c823/32.png) [@EM1](https://discourse.bokeh.org/u/EM1)\
**Post date:** [February 10, 2017, 3:27pm UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/6 "2017-02-10T15:27:23Z")

</div>

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

> **···**
>
> Sent from [Nylas Mail](https://n1.nylas.com/link/4493af92208fa531333b8180176abda4190c1264b3e4d82cd9ddffbd9eaf63a1/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/a0c84705db99d1926a598dfd390181e126fdc76e5d0e6602c207207048f26367/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/0aeb88aa80e6c5ae3e15f4bd3203e5fd7e0bd29c619b476252a26329aae25668/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://n1.nylas.com/link/5859fa3f4f6b56cb88201b697de6435a0281d0c3f95847c4ab56f2c09f4b89bf/0?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1), 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](https://en.wikipedia.org/wiki/Map_projection). 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](http://jswhit.github.io/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](http://spatialreference.org/ref/sr-org/7483/) and [longitude and latitude](http://spatialreference.org/ref/epsg/wgs-84/).
> 
> > > > > On Thu, Feb 9, 2017 at 5:26 PM, EM [ericmajinglong@gmail.com](mailto: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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > > > > 
> > > > > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/567bd8d6-0979-4068-9926-a41468eafcf6%40continuum.io?utm_medium=email&utm_source=footer).
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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](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](mailto:bokeh+unsubscribe@continuum.io).
> > > > > 
> > > > > To post to this group, send email to [bokeh@continuum.io](mailto: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](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFTH9kwu6qp2hZ2qF8W6R%3DAjMRQhAoekXeXYiOdkU-8DXw%40mail.gmail.com?utm_medium=email&utm_source=footer).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:11pm UTC](https://discourse.bokeh.org/t/unable-to-plot-data-on-map-correctly/1956/7 "2021-07-21T21:11:07Z")

</div>


