# Render :kml

**URL:** <https://www.ruby-forum.com/t/render-kml/190604>\
**Category:** Rails\
**Created:** [June 23, 2010, 5:52pm UTC](https://www.ruby-forum.com/t/render-kml/190604 "2010-06-23T17:52:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chewmanfoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c37758/32.png) [@chewmanfoo](https://www.ruby-forum.com/u/chewmanfoo)\
**Post date:** [June 23, 2010, 5:52pm UTC](https://www.ruby-forum.com/t/render-kml/190604/1 "2010-06-23T17:52:53Z")

</div>

kml is an xml format used by Google Maps for specifying a map and  
markers and other things in the GMap. I have a model Carrier which  
has\_many :addresses. Each Address has the standard fields (address1,  
address2, city, state, zip) as well as geocode latitude and longitude  
strings. Is it trivial to render a Carrier’s addresses in a kml  
file? I hope I can include something like this in the carrier  
controller:

def render\_kml(carrier)  
@carrier = Carrier.find(carrier)  
render :kml =\> @carrier.addresses  
end

But I know that I will have to massage the address fields into the kml  
xml schema.

Does anyone know any tutorials for rendering collections into xml  
formats?

Thanks in advance!
