Add marker.

This commit is contained in:
Kevin Dungs 2014-11-17 16:59:10 +01:00
parent af29d6321f
commit 98d26a4b61
2 changed files with 13 additions and 6 deletions

2
app.py
View File

@ -19,7 +19,7 @@ def index():
def showMap(threewords):
try:
lat, lng = these.decode(threewords)
return template('map', lat=lat, lng=lng)
return template('map', lat=lat, lng=lng, threewords=threewords)
except:
return template('index',
err="Could not find location {}".format(threewords))

View File

@ -15,12 +15,19 @@
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: { lat: {{ lat }}, lng: {{ lng }}},
zoom: 14
var loc = {
lat: {{ lat }},
lng: {{ lng }}
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: loc,
zoom: 14
});
var marker = new google.maps.Marker({
position: loc,
map: map,
title: "{{ threewords }}"
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>