i making web app using google maps api v3. want display places on map stored on user's google account's "my places" section on google maps.
i know google maps api support kml , can download kml google maps places. want programmatically.
example:
a user comes website, log in using his/her google credentials , can see list of saved places. after clicking on 1 of them, place appear on map on web app.
please suggest how go it.
i found access locations in places of particular account through google maps api , tried way:
import urllib2, urllib, re, getpass username = 'abhishekworld' senha = getpass.getpass('password' + username + ':') dic = { 'accounttype': 'google', 'email': (username + '@gmail.com'), 'passwd': senha, 'service': 'local', 'source': 'themappers' } url = 'https://www.google.com/accounts/clientlogin?' + urllib.urlencode(dic) print url output = urllib2.urlopen(url).read() authid = output.strip().split('\n')[-1].split('=')[-1] request = urllib2.request('http://maps.google.com/maps/feeds/maps/default/full?access_token='+authid) request.add_header('authorization', 'googlelogin auth=%s' % authid) source = urllib2.urlopen(request).read() open('feed.xml','w').write(source) link in re.findall('<link rel=.alternate. type=.text/html. href=((.)[^\1]*?)>', source): s = link[0] if 'msa=0' in s: msid = s.split(";")[-1] print "https://maps.google.com/maps/ms?authuser=0&vps=2&ie=utf8&msa=0&output=kml&"+msid although works fine, after few logins, google sends email saying "suspicious activity reported", need clean solution. please let me know if there clean way this.
Comments
Post a Comment