Python | Get a google map image of specified location using Google Static Maps API Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Google Static Maps API lets embed a Google Maps image on the web page without requiring JavaScript or any dynamic page loading. The Google Static Maps API service creates the map based on URL parameters sent through a standard HTTP request and returns the map as an image one can display on the web page. To use this service, one must need an API key, get it from here . Note: One need to create billing account on google then only can use Google APIs. Modules needed : Below is the implementation : Python3 # Python program to get a google map # image of specified location using # Google Static Maps API # importing required modules import requests # Enter your api key here api_key = "_your_api_key_" # url variable store url url = "https://maps.googleapis.com/maps/api/staticmap?" # center defines the center of the map, # equidistant from all edges of the map. center = "Dehradun" # zoom defines the zoom # level of the map zoom = 10 # get method of requests module # return response object r = requests.get(url + "center =" + center + "&zoom =" + str(zoom) + "&size = 400x400&key =" + api_key + "sensor = false") # wb mode is stand for write binary mode f = open('address of the file location ', 'wb') # r.content gives content, # in this case gives image f.write(r.content) # close method of file object # save and close the file f.close() Output : Note : For checking whether the API key is properly working or not, store r.content in .txt file, inspite of saving as .png file. If the API key is invalid, API will return this error message instead of image "The Google Maps API server rejected your request. The provided API key is invalid ". Following list shows the approximate level of detail one can expect to see at each zoom level : 1 : World 5 : Landmass/continent 10 : City 15 : Streets 20 : Buildings Comment More infoAdvertise with us Next Article Python | Get a set of places according to search query using Google Places API A ankthon Follow Improve Article Tags : Python Python Programs python-utility Practice Tags : python Similar Reads Python | Get a set of places according to search query using Google Places API Google Places API Web Service allow the user to query for place information on a variety of categories, such as establishments, prominent points of interest, geographic locations, and more. One can search for places either by proximity or a text string. A Place Search returns a list of places along 3 min read Python | Get a set of places according to search query using Google Places API Google Places API Web Service allow the user to query for place information on a variety of categories, such as establishments, prominent points of interest, geographic locations, and more. One can search for places either by proximity or a text string. A Place Search returns a list of places along 3 min read How to Scrape Web Data from Google using Python? Prerequisites: Python Requests, Implementing Web Scraping in Python with BeautifulSoup Web scraping is a technique to fetch data from websites. While surfing on the web, many websites donât allow the user to save data for personal use. One way is to manually copy-paste the data, which both tedious a 2 min read How to Scrape Web Data from Google using Python? Prerequisites: Python Requests, Implementing Web Scraping in Python with BeautifulSoup Web scraping is a technique to fetch data from websites. While surfing on the web, many websites donât allow the user to save data for personal use. One way is to manually copy-paste the data, which both tedious a 2 min read Python | Calculate geographic coordinates of places using google geocoding API Geocoding is the process of converting addresses into geographic coordinates like latitude and longitude, which can be used to mark position on map.To use the Google Maps Geocoding API, one must need an API key, which can be get form here. Modules needed : Below is the implementation : Python3 # Pyt 2 min read Python | Calculate geographic coordinates of places using google geocoding API Geocoding is the process of converting addresses into geographic coordinates like latitude and longitude, which can be used to mark position on map.To use the Google Maps Geocoding API, one must need an API key, which can be get form here. Modules needed : Below is the implementation : Python3 # Pyt 2 min read Like