Skip to content

Instantly share code, notes, and snippets.

@bogardpd

bogardpd/map.rb

Created Sep 30, 2019
Embed
What would you like to do?
/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
You can’t perform that action at this time.