Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python display map with googlemaps

I found a googlemaps package to access google map from python,but didn't find any demo to show the result in python code.

For example:

gmaps = googlemaps.Client(key='Add Your Key here')

# Geocoding an address
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')

# Look up an address with reverse geocoding
reverse_geocode_result = gmaps.reverse_geocode((40.714224, -73.961452))

# Request directions via public transit
now = datetime.now()
directions_result = gmaps.directions("Sydney Town Hall",
                                     "Parramatta, NSW",
                                     mode="transit",
                                     departure_time=now)

I can print the directions_result to console but don't know how to show the map in graphic mode. How to show the search result as a map in python?

like image 725
beetlej Avatar asked Mar 04 '16 14:03

beetlej


People also ask

How do I show Google Maps in Python?

Installation: set up python for this exercise. Get a Google Map API key : this is necessary to be able to display google maps in your applications. How to prepare your data for geographical display : we will use pandas to read the dataset from file, and have a first look at the data before display.

Can you use Google Maps API with Python?

The Java Client, Python Client, Go Client and Node. js Client for Google Maps Services enable you to work with Google Maps web services on your server. They wrap the functionality of the following APIs: Directions API.

Can you import Google Maps in Python?

GoogleMaps library is a python-based library that offers Web Services of Google Maps platform onto your Python application. You can access the Google Maps services like Places, Directions, Distance Matrix, etc. with APIs. GoogleMaps library is the cross-platformed library.


1 Answers

Because googlemaps package is only for data/responses API.


For more information read this tutorial (writing JS map & data analysis): https://github.com/invisibleroads/invisibleroads-tutorials/blob/master/geodjango-googlemaps-build.rst


For plotting data on google maps use: https://github.com/vgm64/gmplot

like image 55
Maciej A. Czyzewski Avatar answered Oct 02 '22 12:10

Maciej A. Czyzewski