Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Bokeh
  • Matplotlib
  • Pandas
  • Seaborn
  • Ggplot
  • Plotly
  • Altair
  • Networkx
  • Machine Learning Math
  • Machin Learning
  • Data Analysis
  • Deep Learning
  • Deep Learning Projects
  • NLP
  • Computer vision
  • Data science
  • Machin Learning Interview question
  • Deep learning interview question
Open In App
Next Article:
Stamen Toner ,Stamen Terrain and Mapbox Bright Maps in Python-Folium
Next article icon

Python Bokeh – Plot for all Types of Google Maps ( roadmap, satellite, hybrid, terrain)

Last Updated : 03 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to display Google maps. To use Google maps in Bokeh, we will use the

gmap()

function of the

plotting

class. There are 4 basic types of Google maps –

roadmap, satellite, hybrid, terrain

We need to configure the Google map using

GMapOptions()

function. The

GMapOptions()

function contains the parameter

map_type

. Using this parameter we can determine the map type of the Google map. Assign one of the 4 values to this parameter discussed above.

In order to use these maps we have to :

  1. Import the required libraries and modules :
    • gmap from bokeh.plotting
    • GMapOptions from bokeh.models
    • output_file and show from bokeh.io
  2. Create a file to store our model using output_file().
  3. Configure the Google map using GMapOptions(). During the configuration, assign the desired value to the map_type parameter.
  4. Generate a GoogleMap object using gmap().
  5. Display the Google map using show().

Roadmap :

This displays the default road map view. In this type of map, the terrain is smoothened and the roads are highlighted. It is suited to navigate an area in a vehicle. This is the default map type.

Python3 1==
# importing the required modules from bokeh.plotting import gmap from bokeh.models import GMapOptions from bokeh.io import output_file, show  # file to save the model output_file("gfg.html")  # configuring the Google map lat = 30.3165 lng = 78.0322 map_type = "roadmap" zoom = 12 google_map_options = GMapOptions(lat = lat,                                  lng = lng,                                  map_type = map_type,                                  zoom = zoom)  # generating the Google map google_api_key = "" title = "Dehradun" google_map = gmap(google_api_key,                   google_map_options,                   title = title)  # displaying the model show(google_map) 

Output :

Satellite :

This displays the Google Earth satellite view. It is the bird-eye view without any sort of graphics.

Python3 1==
# importing the required modules from bokeh.plotting import gmap from bokeh.models import GMapOptions from bokeh.io import output_file, show  # file to save the model output_file("gfg.html")  # configuring the Google map lat = 30.3165 lng = 78.0322 map_type = "satellite" zoom = 12 google_map_options = GMapOptions(lat = lat,                                  lng = lng,                                  map_type = map_type,                                  zoom = zoom)  # generating the Google map google_api_key = "" title = "Dehradun" google_map = gmap(google_api_key,                   google_map_options,                   title = title)  # displaying the model show(google_map) 

Output :

bokeh-gmap-satellite-copy-2


Hybrid :

As the name suggests, this displays the combination of road map and satellite map. The satellite map is overlayed with graphics of roads.

Python3 1==
# importing the required modules from bokeh.plotting import gmap from bokeh.models import GMapOptions from bokeh.io import output_file, show  # file to save the model output_file("gfg.html")  # configuring the Google map lat = 30.3165 lng = 78.0322 map_type = "hybrid" zoom = 12 google_map_options = GMapOptions(lat = lat,                                  lng = lng,                                  map_type = map_type,                                  zoom = zoom)  # generating the Google map google_api_key = "" title = "Dehradun" google_map = gmap(google_api_key,                   google_map_options,                   title = title)  # displaying the model show(google_map) 

Output :

bokeh-gmap-hybrid-copy-2


Terrain :

This displays a physical map based on the terrain information.

Python3 1==
# importing the required modules from bokeh.plotting import gmap from bokeh.models import GMapOptions from bokeh.io import output_file, show  # file to save the model output_file("gfg.html")  # configuring the Google map lat = 30.3165 lng = 78.0322 map_type = "terrain" zoom = 12 google_map_options = GMapOptions(lat = lat,                                  lng = lng,                                  map_type = map_type,                                  zoom = zoom)  # generating the Google map google_api_key = "" title = "Dehradun" google_map = gmap(google_api_key,                   google_map_options,                   title = title)  # displaying the model show(google_map) 

Output :



Next Article
Stamen Toner ,Stamen Terrain and Mapbox Bright Maps in Python-Folium

Y

Yash_R
Improve
Article Tags :
  • AI-ML-DS
  • Data Visualization
  • AI-ML-DS With Python
  • Python-Bokeh

Similar Reads

  • Stamen Toner ,Stamen Terrain and Mapbox Bright Maps in Python-Folium
    Folium library is a powerful data visualization library in Python used by people to visualize geospatial data and maps. With the Folium library, we can create map of any location in the world with the help of latitude and longitude of that location. We can also create interesting visualizations by s
    3 min read
  • Python Bokeh - Plotting Quadrilaterals on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot quadrilaterals on a graph. Plotti
    2 min read
  • Python Bokeh - Plotting Rectangles on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot rectangles on a graph. Plotting r
    2 min read
  • Python Bokeh - Plotting Triangles on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot triangles on a graph. Plotting tr
    2 min read
  • Python Bokeh - Plotting Triangles with Dots on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot triangles with dots on a graph. P
    2 min read
  • Python Bokeh - Plotting Squares with Crosses on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot squares with crosses on a graph.
    2 min read
  • Python Bokeh - Plotting Squares on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot squares on a graph. Plotting squa
    2 min read
  • Python Bokeh - Plotting Squares with Dots on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot squares with dots on a graph. Plo
    2 min read
  • Python Bokeh - Plotting Squares with Xs on a Graph
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot squares with Xs on a graph. Plott
    2 min read
  • Python Bokeh – Plotting glyphs over a Google Map
    Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot glyphs over a Google map. A glyph
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences