点出现在地图谷歌Python代码 [英] Points appear on map google python code
本文介绍了点出现在地图谷歌Python代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用python开发地图(Google地图)并在特定位置添加一些点。搜索后,我发现它可以使用 pygmaps 完成。所以我使用 pip
来安装它,然后我编写了这段代码,我需要添加点并为地图打开一个网页,以查找点。
导入pygmaps
导入webbrowser
mymap = pygmaps.maps(37.428,-122.145,16)
mymap.setgrids( 37.42,37.43,0.001,-122.15,-122.14,0.001)
mymap.addpoint(37.427,-122.145,#0000FF)
mymap.addradpoint(37.429,-122.145,95,#FF0000 )
path = [(37.429,-122.145),(37.428,-122.145),(37.427,-122.145),(37.427,-122.146),(37.427,-122.146)] mymap.addpath(path, #00FF00)
mymap.draw('./ mymap.draw.html')
url = url ='./mymap.draw.html'
webbrowser.open_new_tab(url)
我没有看到积分,只有地图。
<更改
mymap.draw('./ mymap。 draw.html')
url = url ='./mymap.draw.html'
到
mymap .draw('mymap.draw.html')
url ='mymap.draw.html'
编辑:添加了屏幕截图。
$ b
I'm using python to develop a map (Google Maps) and add some points in specific location. After searching I found it can be done using pygmaps. So I installed it using pip
, then I wrote this code and I need to add points and open a webpage for the map find the points there.
import pygmaps
import webbrowser
mymap = pygmaps.maps(37.428, -122.145, 16)
mymap.setgrids(37.42, 37.43, 0.001, -122.15, -122.14, 0.001)
mymap.addpoint(37.427, -122.145, "#0000FF")
mymap.addradpoint(37.429, -122.145, 95, "#FF0000")
path = [(37.429, -122.145),(37.428, -122.145),(37.427, -122.145),(37.427, -122.146),(37.427, -122.146)] mymap.addpath(path,"#00FF00")
mymap.draw('./mymap.draw.html')
url = url = './mymap.draw.html'
webbrowser.open_new_tab(url)
I didn't see the points, only the map.
解决方案
Changing
mymap.draw('./mymap.draw.html')
url = url = './mymap.draw.html'
to
mymap.draw('mymap.draw.html')
url = 'mymap.draw.html'
worked for me.
Edit: added screenshot.
这篇关于点出现在地图谷歌Python代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文