سلام
یک script ساده نوشتم برای استفاده نشون دادن یک نقطه توی Google map گفتم شاید به درد بقیه هم بخوره:
[code=python]
from xml.etree.ElementTree import parse
import urllib
import webbrowser
latText = ''
lonText = ''
u = urllib.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22'
data = u.read()
f = open('rt22.xml', 'wb'
f.write(data)
f.close()
doc = parse('rt22.xml'
for bus in doc.findall('bus'
:
busID = bus.findtext('id'
d = bus.findtext('d'
latText = bus.findtext('lat'
lonText = bus.findtext('lon'
latNum = float(latText)
lonNum = float(lonText)
print "BUS(ID:"+busID+", lat:"+latText+", lon:"+lonText+"
heading ", d
URL = "http://maps.google.com/maps/api/staticmap?center="+latText+","+lonT ext+\
"&zoom=13&markers="+latText+&quo t;,"+lonText+"&path=color:0x0000FF80 |weight:5|37.37608,\
-122.08145&size=500x300&sensor=TRUE_OR_FALS E"
webbrowser.open(URL)
[/code]
این script اتوبوس های موجود در خط خیابان22 شهر chicago رو دانلود میکنه و توی Static GoogleMap نشون میده
یک script ساده نوشتم برای استفاده نشون دادن یک نقطه توی Google map گفتم شاید به درد بقیه هم بخوره:
[code=python]
from xml.etree.ElementTree import parse
import urllib
import webbrowser
latText = ''
lonText = ''
u = urllib.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22'

data = u.read()
f = open('rt22.xml', 'wb'

f.write(data)
f.close()
doc = parse('rt22.xml'

for bus in doc.findall('bus'

busID = bus.findtext('id'

d = bus.findtext('d'

latText = bus.findtext('lat'

lonText = bus.findtext('lon'

latNum = float(latText)
lonNum = float(lonText)
print "BUS(ID:"+busID+", lat:"+latText+", lon:"+lonText+"

URL = "http://maps.google.com/maps/api/staticmap?center="+latText+","+lonT ext+\
"&zoom=13&markers="+latText+&quo t;,"+lonText+"&path=color:0x0000FF80 |weight:5|37.37608,\
-122.08145&size=500x300&sensor=TRUE_OR_FALS E"
webbrowser.open(URL)
[/code]
این script اتوبوس های موجود در خط خیابان22 شهر chicago رو دانلود میکنه و توی Static GoogleMap نشون میده