Tristan Tran
Tristan Tran

Reputation: 1533

Center bokeh tile provider map around specific GPS coordinates

Using bokeh example of displaying mercator map here, how do I center the map around a specific set of GPS coordinates?

from bokeh.plotting import figure, output_file, show
from bokeh.tile_providers import CARTODBPOSITRON_RETINA, get_provider

output_file("tile.html")

tile_provider = get_provider(CARTODBPOSITRON_RETINA)

# range bounds supplied in web mercator coordinates
p = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
           x_axis_type="mercator", y_axis_type="mercator")
p.add_tile(tile_provider)

show(p)

Upvotes: 0

Views: 372

Answers (1)

mosc9575
mosc9575

Reputation: 6347

After you got the tile_provider you can change the default values like below:

tile_provider.x_origin_offset = 20037508.34
tile_provider.y_origin_offset = 25037508.34
tile_provider.initial_resolution = 180000

new focus for a map

Upvotes: 1

Related Questions