Better Python Practices for the GeoWeb
http://sgillies.net/blog/584/better-python-practices-for-the-geoweb/
<?xml version="1.0" encoding="utf-8"?>
<kml
xmlns="http://earth.google.com/kml/2.1"
xmlns:py="http://genshi.edgewall.org/"
>
<Folder>
<Style id="fireIcon">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark py:for="item in collection">
<name py:content="item['name']">NAME</name>
<styleUrl>#fireIcon</styleUrl>
<description py:content="item['description']">
DESCRIPTION
</description>
<Point>
<coordinates py:content="item['coordinates']">
LONG,LAT
</coordinates>
</Point>
</Placemark>
</Folder>
</kml>
I created a function that works in other files called "kml".
Now created a file kml.kml in views/default:
<?xml version="1.0" encoding="utf-8"?>
<kml
xmlns="http://earth.google.com/kml/2.1"
>
<Folder>
<Style id="fireIcon">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
</Icon>
</IconStyle>
</Style>
{{for placemark in placemarks:}}
<Placemark>
<name >{{=placemark.name}}</name>
<styleUrl>#fireIcon</styleUrl>
<description">
{{=placemark.description}}
</description>
<Point>
<coordinates >
{{=placemark.lon}}, {{=placemark.lat}}
</coordinates>
</Point>
</Placemark>
{{pass}}
</Folder>
</kml>
But when I enter the URL in the browser I get an invalid request.
Why?
If I rename the file to kml.html it returns the query result only.
How do I need to change my controller that web2py delivers xml using my
kml.kml template file?
Thanks in advance,
Timmie