How to create a map with Bokeh with a satellite image in the background ?

Published: February 02, 2024

Updated: February 02, 2024

Tags: Python; Bokeh;

DMCA.com Protection Status

Introduction

Bokeh is a Python interactive visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics, and affords high-performance interactivity over large or streaming datasets. Bokeh can produce not just standalone HTML documents and server-hosted content.

In this article, we will delve into various methods of crafting a straightforward map using Bokeh.

Using the Esri World Imagery

One solution is to use the Esri World Imagery which is a basemap that offers the most recent satellite imagery for any place in the world. This allows you to access satellite imagery with high resolution and accurate geospatial information without having to purchase or manage large datasets:

from bokeh.plotting import figure, show

p = figure(x_range=(-2000000, 6000000), 
           y_range=(4000000, 7000000),
           x_axis_type="mercator", 
           y_axis_type="mercator")

p.add_tile("Esri World Imagery")

show(p)

The code above imports the necessary components from Bokeh, sets the output file to be generated, and creates a figure with specified range bounds. The add_tile() function overlays a satellite image on top of the figure, and show() renders the map in an HTML document.

How to Create a Map with Bokeh Using a Satellite Image ?
How to Create a Map with Bokeh Using a Satellite Image ?

We can then zoom out gradually:

How to Create a Map with Bokeh Using a Satellite Image ?
How to Create a Map with Bokeh Using a Satellite Image ?

References

Links Site
tile_demo docs.bokeh.org
Mapping Geo Data docs.bokeh.org
Creating an interactive map in Python using Bokeh and pandas towardsdatascience.com
Mapping geo data docs.bokeh.org
Image

of