Overlaying glyph on map

Hello folks,

I am trying to plot a list of locations(venues) on a map using Bokeh. I followed instruction provided here.

**Input data file(****mstr_venue.xlsx)**is as given below:

VENUE_NAME
UTM_ZONE
UTM_EASTING
UTM_NORTHING
YOKOSUKA
54S
378799.0717
3905309.408
YESOU
52S
362069.0896
3868327.02
PENGERANG
48N
401730.9231
151075.9234
SINGAPORE
48N
334963.429
140052.0691
LUANDA
33L
305811.3973
9022728.704
PORT GENTIL
32M
475891.8916
9920786.506
CAPE LOPEZ
32M
466619.3812
9930033.487
LAS PALMAS
28R
459085.6772
3113889.013
SARROCH
32S
500810.613
4324075.234
ALGECIRAS
30S
280896.4098
4001779.527

The code that I wrote is as follows:

from bokeh.plotting import figure, show, output_file, ColumnDataSource

from bokeh.tile_providers import CARTODBPOSITRON_RETINA

from bokeh.models.sources import ColumnarDataSource

from bokeh.layouts import layout, widgetbox, column, row

from bokeh.models import Range1d, PanTool, ResetTool, HoverTool

import pandas as pd

import numpy as np

df = pd.read_excel(‘mstr_venue.xlsx’)

output_file(“venue.html”)

source = ColumnDataSource(data=dict(longitude=df[‘UTM_EASTING’], latitude=df[‘UTM_NORTHING’], venue_name=df[‘VENUE_NAME’]))

p = figure(plot_width=400, plot_height=400, x_range=(-2000000, 6000000), y_range=(-1000000, 7000000), x_axis_type=“mercator”, y_axis_type=“mercator”)

p.add_tile(CARTODBPOSITRON_RETINA)

p.circle(x=‘longitude’, y=‘latitude’, source=source)

hover = HoverTool(tooltips=[(“Venue: “,”@venue_name”)])

p.add_tools(hover)

show§

The output is as shown below:

Observation:

The circle glyph are not plotted in the correct geographic location. I am not sure what I am missing. Looking for some references.

Thanking you in advance,

clemy

Hi,

On a web mercator axis the expected coordinates are mercator northings/eastings, not lat/lon.

Thanks,

Bryan

···

On Aug 2, 2018, at 07:22, Clement Francis <[email protected]> wrote:

Hello folks,

I am trying to plot a list of locations(venues) on a map using Bokeh. I followed instruction provided here.

Input data file(mstr_venue.xlsx) is as given below:

VENUE_NAME UTM_ZONE UTM_EASTING UTM_NORTHING
YOKOSUKA 54S 378799.0717 3905309.408
YESOU 52S 362069.0896 3868327.02
PENGERANG 48N 401730.9231 151075.9234
SINGAPORE 48N 334963.429 140052.0691
LUANDA 33L 305811.3973 9022728.704
PORT GENTIL 32M 475891.8916 9920786.506
CAPE LOPEZ 32M 466619.3812 9930033.487
LAS PALMAS 28R 459085.6772 3113889.013
SARROCH 32S 500810.613 4324075.234
ALGECIRAS 30S 280896.4098 4001779.527

The code that I wrote is as follows:

from bokeh.plotting import figure, show, output_file, ColumnDataSource
from bokeh.tile_providers import CARTODBPOSITRON_RETINA
from bokeh.models.sources import ColumnarDataSource
from bokeh.layouts import layout, widgetbox, column, row
from bokeh.models import Range1d, PanTool, ResetTool, HoverTool
import pandas as pd
import numpy as np

df = pd.read_excel('mstr_venue.xlsx')
output_file("venue.html")

source = ColumnDataSource(data=dict(longitude=df['UTM_EASTING'], latitude=df['UTM_NORTHING'], venue_name=df['VENUE_NAME']))

p = figure(plot_width=400, plot_height=400, x_range=(-2000000, 6000000), y_range=(-1000000, 7000000), x_axis_type="mercator", y_axis_type="mercator")
p.add_tile(CARTODBPOSITRON_RETINA)
p.circle(x='longitude', y='latitude', source=source)

hover = HoverTool(tooltips=[("Venue: ","@venue_name")])
p.add_tools(hover)
show(p)

The output is as shown below:

Observation:
The circle glyph are not plotted in the correct geographic location. I am not sure what I am missing. Looking for some references.

Thanking you in advance,
clemy

--
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/8e15daac-9578-439f-9626-d10a1be1d62d%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hey Bryan,

I thought UTM was based on mercator and hence compatable.

Any advice on converting GPS location 40° 41′ 21.4” N 74° 02′ 40.2” W (DMS) or UTM to a mercator?

Thank you.

···

On Thu, 2 Aug 2018, 20:41 Bryan Van de ven, [email protected] wrote:

Hi,

On a web mercator axis the expected coordinates are mercator northings/eastings, not lat/lon.

Thanks,

Bryan

On Aug 2, 2018, at 07:22, Clement Francis [email protected] wrote:

Hello folks,

I am trying to plot a list of locations(venues) on a map using Bokeh. I followed instruction provided here.

Input data file(mstr_venue.xlsx) is as given below:

VENUE_NAME UTM_ZONE UTM_EASTING UTM_NORTHING

YOKOSUKA 54S 378799.0717 3905309.408

YESOU 52S 362069.0896 3868327.02

PENGERANG 48N 401730.9231 151075.9234

SINGAPORE 48N 334963.429 140052.0691

LUANDA 33L 305811.3973 9022728.704

PORT GENTIL 32M 475891.8916 9920786.506

CAPE LOPEZ 32M 466619.3812 9930033.487

LAS PALMAS 28R 459085.6772 3113889.013

SARROCH 32S 500810.613 4324075.234

ALGECIRAS 30S 280896.4098 4001779.527

The code that I wrote is as follows:

from bokeh.plotting import figure, show, output_file, ColumnDataSource

from bokeh.tile_providers import CARTODBPOSITRON_RETINA

from bokeh.models.sources import ColumnarDataSource

from bokeh.layouts import layout, widgetbox, column, row

from bokeh.models import Range1d, PanTool, ResetTool, HoverTool

import pandas as pd

import numpy as np

df = pd.read_excel(‘mstr_venue.xlsx’)

output_file(“venue.html”)

source = ColumnDataSource(data=dict(longitude=df[‘UTM_EASTING’], latitude=df[‘UTM_NORTHING’], venue_name=df[‘VENUE_NAME’]))

p = figure(plot_width=400, plot_height=400, x_range=(-2000000, 6000000), y_range=(-1000000, 7000000), x_axis_type=“mercator”, y_axis_type=“mercator”)

p.add_tile(CARTODBPOSITRON_RETINA)

p.circle(x=‘longitude’, y=‘latitude’, source=source)

hover = HoverTool(tooltips=[(“Venue: “,”@venue_name”)])

p.add_tools(hover)

show§

The output is as shown below:

Observation:

The circle glyph are not plotted in the correct geographic location. I am not sure what I am missing. Looking for some references.

Thanking you in advance,

clemy

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/8e15daac-9578-439f-9626-d10a1be1d62d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.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/9FC66126-DEEB-480F-B2CF-4459FA4FAE8D%40anaconda.com.

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

Hi,

There are some python implementations of "lat/lon to web mercator" online that I have found by searching online. However, it looks as though your data already has columns for the northing/easting values. In which case, you can just use them directly.

Alternatively, you might have a look at GeoViews, which is a higher level API and can produce Bokeh output for some cases:

  http://geo.holoviews.org/

Thanks,

Bryan

···

On Aug 2, 2018, at 09:06, Clement Francis <[email protected]> wrote:

Hey Bryan,

I thought UTM was based on mercator and hence compatable.

Any advice on converting GPS location 40° 41′ 21.4” N 74° 02′ 40.2” W (DMS) or UTM to a mercator?

Thank you.

On Thu, 2 Aug 2018, 20:41 Bryan Van de ven, <[email protected]> wrote:
Hi,

On a web mercator axis the expected coordinates are mercator northings/eastings, not lat/lon.

Thanks,

Bryan

> On Aug 2, 2018, at 07:22, Clement Francis <[email protected]> wrote:
>
> Hello folks,
>
> I am trying to plot a list of locations(venues) on a map using Bokeh. I followed instruction provided here.
>
>
> Input data file(mstr_venue.xlsx) is as given below:
>
> VENUE_NAME UTM_ZONE UTM_EASTING UTM_NORTHING
> YOKOSUKA 54S 378799.0717 3905309.408
> YESOU 52S 362069.0896 3868327.02
> PENGERANG 48N 401730.9231 151075.9234
> SINGAPORE 48N 334963.429 140052.0691
> LUANDA 33L 305811.3973 9022728.704
> PORT GENTIL 32M 475891.8916 9920786.506
> CAPE LOPEZ 32M 466619.3812 9930033.487
> LAS PALMAS 28R 459085.6772 3113889.013
> SARROCH 32S 500810.613 4324075.234
> ALGECIRAS 30S 280896.4098 4001779.527
>
> The code that I wrote is as follows:
>
> from bokeh.plotting import figure, show, output_file, ColumnDataSource
> from bokeh.tile_providers import CARTODBPOSITRON_RETINA
> from bokeh.models.sources import ColumnarDataSource
> from bokeh.layouts import layout, widgetbox, column, row
> from bokeh.models import Range1d, PanTool, ResetTool, HoverTool
> import pandas as pd
> import numpy as np
>
> df = pd.read_excel('mstr_venue.xlsx')
> output_file("venue.html")
>
> source = ColumnDataSource(data=dict(longitude=df['UTM_EASTING'], latitude=df['UTM_NORTHING'], venue_name=df['VENUE_NAME']))
>
> p = figure(plot_width=400, plot_height=400, x_range=(-2000000, 6000000), y_range=(-1000000, 7000000), x_axis_type="mercator", y_axis_type="mercator")
> p.add_tile(CARTODBPOSITRON_RETINA)
> p.circle(x='longitude', y='latitude', source=source)
>
> hover = HoverTool(tooltips=[("Venue: ","@venue_name")])
> p.add_tools(hover)
> show(p)
>
> The output is as shown below:
>
>
>
> Observation:
> The circle glyph are not plotted in the correct geographic location. I am not sure what I am missing. Looking for some references.
>
> Thanking you in advance,
> clemy
>
>
>
>
>
>
>
>
> --
> 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/8e15daac-9578-439f-9626-d10a1be1d62d%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.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/9FC66126-DEEB-480F-B2CF-4459FA4FAE8D%40anaconda.com.
For more options, visit https://groups.google.com/a/continuum.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/CAJSnT_JydS30DPPsctW_wxc775EdYvFQ1SiBQL6-JtxxEUgoew%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.