2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 $Spotter = new Spotter();
5 if (isset($_GET['download']))
7 header('Content-disposition: attachment; filename="waypoints.geojson"');
9 header('Content-Type: text/javascript');
11 if (isset($_GET['coord']))
13 $coords = explode(',',$_GET['coord']);
14 $spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords);
19 $output = '{"type": "FeatureCollection","features": [';
21 if (!empty($spotter_array))
23 // print_r($spotter_array);
24 foreach($spotter_array as $spotter_item)
26 date_default_timezone_set('UTC');
28 $output .= '{"type": "Feature",';
29 $output .= '"properties": {';
30 $output .= '"segment_name": "'.$spotter_item['segment_name'].'",';
31 $output .= '"base": "'.$spotter_item['base'].'",';
32 $output .= '"top": "'.$spotter_item['top'].'",';
33 $output .= '"name_begin": "'.$spotter_item['name_begin'].'",';
34 $output .= '"name_end": "'.$spotter_item['name_end'].'",';
35 // $output .= '"ident": "'.$spotter_item['name_begin'].'",';
36 // $output .= '"popupContent": "'.$spotter_item['name_begin'].'",';
37 /* if ($spotter_item['usage'] == 'RNAV') {
38 $output .= '"icon": "images/flag_green.png"';
39 } elseif ($spotter_item['usage'] == 'High Level') {
40 $output .= '"icon": "images/flag_red.png"';
41 } elseif ($spotter_item['usage'] == 'Low Level') {
42 $output .= '"icon": "images/flag_yellow.png"';
43 } elseif ($spotter_item['usage'] == 'High and Low Level') {
44 $output .= '"icon": "images/flag_orange.png"';
45 } elseif ($spotter_item['usage'] == 'Terminal') {
46 $output .= '"icon": "images/flag_finish.png"';
48 $output .= '"icon": "images/flag_blue.png",';
49 $output .= '"stroke": "#f0f0f0",';
50 $output .= '"stroke-width": 2';
53 $output .= '"geometry": {';
54 $output .= '"type": "LineString",';
55 $output .= '"coordinates": [';
56 //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57 $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
58 // $output .= '['.$spotter_item['latitude_begin'].', '.$spotter_item['longitude_begin'].'], ['.$spotter_item['latitude_end'].', '.$spotter_item['longitude_end'].']';
61 /* $output .= '"geometry": {';
62 $output .= '"type": "Point",';
63 $output .= '"coordinates": [';
64 $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'];
70 $output .= '{"type": "Feature",';
71 $output .= '"properties": {';
72 $output .= '"ident": "'.$spotter_item['name_begin'].'",';
73 $output .= '"high": "'.$spotter_item['high'].'",';
74 $output .= '"alt": "'.$spotter_item['base'].'",';
75 // $output .= '"popupContent": "'.$spotter_item['name_begin'].'",';
76 if ($spotter_item['high'] == '') {
77 $output .= '"icon": "images/flag_green.png",';
78 $output .= '"marker-symbol": "marker",';
79 $output .= '"marker-size": "small",';
80 $output .= '"marker-color": "#00aa00"';
81 } elseif ($spotter_item['high'] == '2') {
82 $output .= '"icon": "images/flag_red.png",';
83 $output .= '"marker-symbol": "marker",';
84 $output .= '"marker-size": "small",';
85 $output .= '"marker-color": "#ff0000"';
86 } elseif ($spotter_item['high'] == '1') {
87 $output .= '"icon": "images/flag_yellow.png",';
88 $output .= '"marker-symbol": "marker",';
89 $output .= '"marker-size": "small",';
90 $output .= '"marker-color": "#ffff00"';
91 // } elseif ($spotter_item['usage'] == 'High and Low Level') {
92 // $output .= '"icon": "images/flag_orange.png"';
93 // } elseif ($spotter_item['usage'] == 'Terminal') {
94 // $output .= '"icon": "images/flag_finish.png"';
96 $output .= '"icon": "images/flag_blue.png",';
97 $output .= '"marker-symbol": "marker",';
98 $output .= '"marker-size": "small",';
99 $output .= '"marker-color": "#0000ff"';
102 $output .= '"geometry": {';
103 $output .= '"type": "Point",';
104 $output .= '"coordinates": [';
105 $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
110 $output .= '{"type": "Feature",';
111 $output .= '"properties": {';
112 $output .= '"ident": "'.$spotter_item['name_end'].'",';
113 $output .= '"high": "'.$spotter_item['high'].'",';
114 $output .= '"alt": "'.$spotter_item['top'].'",';
115 // $output .= '"popupContent": "'.$spotter_item['name_begin'].'",';
116 if ($spotter_item['high'] == '') {
117 $output .= '"icon": "images/flag_green.png",';
118 $output .= '"marker-symbol": "marker",';
119 $output .= '"marker-size": "small",';
120 $output .= '"marker-color": "#00aa00"';
121 } elseif ($spotter_item['high'] == '2') {
122 $output .= '"icon": "images/flag_red.png",';
123 $output .= '"marker-symbol": "marker",';
124 $output .= '"marker-size": "small",';
125 $output .= '"marker-color": "#ff0000"';
126 } elseif ($spotter_item['high'] == '1') {
127 $output .= '"icon": "images/flag_yellow.png",';
128 $output .= '"marker-symbol": "marker",';
129 $output .= '"marker-size": "small",';
130 $output .= '"marker-color": "#ffff00"';
131 /* if ($spotter_item['usage'] == 'RNAV') {
132 $output .= '"icon": "images/flag_green.png"';
133 } elseif ($spotter_item['usage'] == 'High Level') {
134 $output .= '"icon": "images/flag_red.png"';
135 } elseif ($spotter_item['usage'] == 'Low Level') {
136 $output .= '"icon": "images/flag_yellow.png"';
137 } elseif ($spotter_item['usage'] == 'High and Low Level') {
138 $output .= '"icon": "images/flag_orange.png"';
139 } elseif ($spotter_item['usage'] == 'Terminal') {
140 $output .= '"icon": "images/flag_finish.png"';
143 $output .= '"icon": "images/flag_blue.png",';
144 $output .= '"marker-symbol": "marker",';
145 $output .= '"marker-size": "small",';
146 $output .= '"marker-color": "#0000ff"';
149 $output .= '"geometry": {';
150 $output .= '"type": "Point",';
151 $output .= '"coordinates": [';
152 $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
159 $output = substr($output, 0, -1);