Created
September 30, 2019 01:07
-
-
Save bogardpd/290ca15894fdfbed96ce7a008c2fc160 to your computer and use it in GitHub Desktop.
/app/classes/map.rb KML Points (Airports)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/app/classes/map.rb | |
def kml_airports(airports) | |
airports = airports.sort_by{|a| @airport_details[a][:iata]} | |
return content_tag(:Folder) do | |
concat content_tag(:name, "Airports") | |
concat safe_join(airports.map{|a| kml_airport(a)}) | |
end | |
end | |
def kml_airport(airport_id) | |
detail = @airport_details[airport_id] | |
return content_tag(:Placemark) do | |
concat content_tag(:name, detail[:iata] + " / " + detail[:icao]) | |
concat content_tag(:description, detail[:city]) | |
concat content_tag(:styleUrl, "#airportMarker") | |
concat content_tag(:Point, content_tag(:coordinates, "#{detail[:longitude]},#{detail[:latitude]},0")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment