蟒蛇显示地图与谷歌地图 [英] python display map with googlemaps
问题描述
我发现一个 googlemaps 软件包可以从python访问谷歌地图,但didn找不到任何演示在python代码中显示结果。
例如:
gmaps = googlemaps.Client(key ='在此处添加您的密钥')
#对地址进行地址解析
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway,Mountain View, CA')
#查找带反向地理编码的地址
reverse_geocode_result = gmaps.reverse_geocode((40.714224,-73.961452))
#通过公共交通
now = datetime.now()
directions_result = gmaps.directions(Sydney Town Hall,
Parramatta,NSW,
mode =transit,
departure_time = now)
我可以将directions_result打印到控制台,但不知道如何以图形模式显示地图。如何在python中将搜索结果显示为地图?
因为 googlemaps 包仅适用于数据/响应API。
欲了解更多信息,请阅读本教程(编写JS地图和数据分析): http://invisibleroads.com/tutorials/geodjango-googlemaps-build.html
为了绘制谷歌地图上的数据,请使用: https ://github.com/vgm64/gmplot
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?
Because googlemaps package is only for data/responses API.
For more information read this tutorial (writing JS map & data analysis): http://invisibleroads.com/tutorials/geodjango-googlemaps-build.html
For plotting data on google maps use: https://github.com/vgm64/gmplot
这篇关于蟒蛇显示地图与谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!