2

I'm using python to create a googlemaps with points marked in specific locations.

Adding point, I found, can be done using pygmaps. Now 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 = 'http://maps.google.com'
webbrowser.open_new_tab(url)

But my map did not appear. Can any one help me and tell me what I'm doing wrong?

2 Answers 2

5

I tested your code and I believe I've found the problem. Right now, you're just opening the default Google Maps page, which knows nothing about the map you defined. Instead, change the next-to-last line to:

url = './mymap.draw.html'

and your map will appear in a new tab, exactly as specified. Have fun! :)

Sign up to request clarification or add additional context in comments.

2 Comments

OHHHH I really appreciate that thankkkk u soooooooooooooooooo muchhh !! Danke Danke =)
@ingy No problem, thanks for the pointer to pygmaps. I'll have to play with that more sometime.
0
mymap.draw('mymap.draw.html') 
url = 'mymap.draw.html'
webbrowser.open_new(url)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.