Files
weewx/skins/Standard/map.inc
2017-01-29 13:11:47 -05:00

35 lines
912 B
HTML

## map module for standard skin
## Copyright Tom Keffer, Matthew Wall
## See LICENSE.txt for your rights
#errorCatcher Echo
#if $Extras.has_key('google_map_apikey')
<div id='map_widget' class="widget">
<div class="widget_title">
Location
<a class="widget_control"
onclick="toggle_widget('map')">&diams;</a>
</div>
<div class="widget_contents">
<div id='map_canvas'"></div>
</div>
</div>
<script>
function init_map() {
var latlng = {lat: $station.latitude_f, lng: $station.longitude_f};
var map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 8,
center: latlng
});
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "$station.location"
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=${Extras.google_map_apikey}&callback=init_map" async defer>
</script>
#end if