2 <& /elements/header-popup.html, {
4 head => include('.head'),
5 etc => 'onload="initialize()"',
10 <div id="directions_panel"></div>
11 <div id="map_canvas"></div>
14 % my $lat = $cgi->param('lat');
15 % my $lon = $cgi->param('lon');
16 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
18 <style type="text/css">
21 body { height: 100%; margin: 0px; padding: 0px }
36 #map_canvas { height: 500px; margin: 0; }
37 #directions_panel { float: none; width: auto; }
41 <script type="text/javascript"
42 src="https://maps.google.com/maps/api/js?v=3.4&sensor=false">
45 <script type="text/javascript">
49 function show_route() {
50 var panel = document.getElementById('directions_panel');
51 var directionsService = new google.maps.DirectionsService;
52 var directionsDisplay = new google.maps.DirectionsRenderer;
53 directionsDisplay.setMap(map);
54 directionsDisplay.setPanel(panel);
56 var directionsRequest = {
57 origin: <%$origin |js_string%>,
58 destination: <% $lat %>+","+<% $lon %>,
59 travelMode: google.maps.TravelMode.DRIVING
62 directionsService.route(directionsRequest, function(result, status) {
63 if ( status == google.maps.DirectionsStatus.OK ) {
64 directionsDisplay.setDirections(result);
69 function initialize() {
73 mapTypeId: google.maps.MapTypeId.ROADMAP
76 map = new google.maps.Map(
77 document.getElementById("map_canvas"),
80 map.setOptions( {rotateControl : true });
87 my ($lat, $lon, $name, $origin);
91 $name = $cgi->param('name');
93 $lat = $cgi->param('lat');
94 $lon = $cgi->param('lon');
95 $lat =~ /^-?\d+(\.\d+)?$/ or die "bad latitude: $lat";
96 $lon =~ /^-?\d+(\.\d+)?$/ or die "bad longitude: $lat";
98 $origin = $cgi->param('origin') or die "no origin specified";