Add marker.
This commit is contained in:
parent
af29d6321f
commit
98d26a4b61
2
app.py
2
app.py
|
@ -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))
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue