Hi,
I've been looking into this., and it seems google changed a lot. I
didn't manage to get everything working, but maybe it helps a
little...
1] The maps version is currently 120, so change the number in this
line to 120:
mapfiles = '
http://www.google.com/intl/en_us/mapfiles/120/maps2'
2] Further I noticed three more javascripts were added:
- mod_lyrsctrl
- mod_trends
- mod_infowindow.js
They need to be fetched accordingly:
# get mod_lyrsctrl.js and transmogrify
if not os.path.isfile(os.path.join(RUN_FROM_DIR, 'data',
'mod_lyrsctrl.js')):
print 'downloading:', mapfiles+'/mod_lyrsctrl.js'
oa = openanything.fetch(mapfiles+'/mod_lyrsctrl.js',
agent=useragent)
js = oa['data']
js = js.replace('
http://maps.google.com','data')
js = js.replace('/mapfiles','')
file = open( os.path.join(RUN_FROM_DIR, 'data',
'mod_lyrsctrl.js'), 'w' )
file.write( js )
file.close()
# get mod_trends.js and transmogrify
if not os.path.isfile(os.path.join(RUN_FROM_DIR, 'data',
'mod_trends.js')):
print 'downloading:', mapfiles+'/mod_trends.js'
oa = openanything.fetch(mapfiles+'/mod_trends.js',
agent=useragent)
js = oa['data']
js = js.replace('
http://maps.google.com','data')
js = js.replace('/mapfiles','')
file = open( os.path.join(RUN_FROM_DIR, 'data',
'mod_trends.js'), 'w' )
file.write( js )
file.close()
# get mod_infowindow.js and transmogrify
if not os.path.isfile(os.path.join(RUN_FROM_DIR, 'data',
'mod_infowindow.js')):
print 'downloading:', mapfiles+'/mod_infowindow.js'
oa = openanything.fetch(mapfiles+'/mod_infowindow.js',
agent=useragent)
js = oa['data']
js = js.replace('
http://maps.google.com','data')
js = js.replace('/mapfiles','')
file = open( os.path.join(RUN_FROM_DIR, 'data',
'mod_infowindow.js'), 'w' )
file.write( js )
file.close()
3] And finally I noticed that the html code still referred to some
files at google website instead of the local files. So one more line
need to added below
html = soup.prettify()
html = html.replace(mapfiles, './data')
html = html.replace('
http://www.google.com/intl/en_us/mapfiles',
'./data')
add this:
html = html.replace('/intl/en_ALL/mapfiles/120/maps2', './data/')
After these changes, the gapp error is gone, and the ogmap.html file
will work. However, the tiles do not load and instead you will see the
"sorry we don't have maps for this zoom level". I suspect the problem
to be in the main.js. Not sure if this trick is still working:
js = js.replace('function rf(a,b){','function rf(a,b){b =
b.replace("tiles/mt?","tiles/mt_");')
ciao,
Dammie