1 2package require flightaware 3package require flightaware-track 4package require flightaware-db 5package require yajltcl 6 7# 8# generate geo-JSON for major airports - now with caching 9# 10proc flightaware_track_geojson_major_airports {} { 11 yajl create yajo 12 13 yajo map_open string type string FeatureCollection string features array_open 14 15 foreach majAirport $::majorAirports { 16 lassign [flightaware_airportCodeToNameAndCity $majAirport] name city thisLat thisLon 17 if {$thisLat != "" && $thisLon != ""} { 18 yajo map_open string type string Feature string geometry map_open string type string Point string coordinates array_open number $thisLon number $thisLat array_close map_close string properties map_open string label string $majAirport map_close map_close 19 } 20 } 21 22 yajo array_close map_close 23 24 set ::majorAirportGeoJson [yajo get] 25 catch {rename yajo ""} 26 return $::majorAirportGeoJson 27} 28 29 30flightaware_track_geojson_major_airports 31