Skip to content

Instantly share code, notes, and snippets.

@bogardpd
Created September 30, 2019 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogardpd/290ca15894fdfbed96ce7a008c2fc160 to your computer and use it in GitHub Desktop.
Save bogardpd/290ca15894fdfbed96ce7a008c2fc160 to your computer and use it in GitHub Desktop.
/app/classes/map.rb KML Points (Airports)
#/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