Hey group and Tony
I also generate KML on the fly with app engine and could prefer a statically
generated file instead:
class KMLHandler(webapp.RequestHandler):#make static, cron job save file
like blob
def get(self):
start=datetime.datetime.now()-timedelta(days=10)#vary
host = os.environ.get("HTTP_HOST", os.environ["SERVER_NAME"])
logging.debug('host '+host)
count = int(self.request.get('count')) if not
self.request.get('count')=='' else 1000
from google.appengine.api import memcache
memcache.flush_all()
memcache_key = "articles"
data = memcache.get(memcache_key)
if data is None:
articles= Article.all().filter("modified >",
start).filter("published =", True).order("-modified").fetch(count)
memcache.set("articles", a)
else:
articles = data
dispatch='templates/kml.html'
template_values = {'articles': articles , 'request':self.request,
'host':host}
path = os.path.join(os.path.dirname(__file__), dispatch)
self.response.out.write(template.render(path, template_values))
And KML template
<?xml version="1.0" encoding="UTF-8"?><kml
xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document>{% for article in articles %}{% if article.geopt %}
<Placemark><name></name><description><![CDATA[{% if article.kmluri2view
%}<img src="http://{{host}}/images/{{ article.kmluri2view.key.id }}.jpg">{%
endif %}<a href="http://{{host}}/{{article.key.id}}"> {{ article.title }}
</a><br/>{{article.text}}]]></description><Point><coordinates>{{article.geopt.lon|floatformat:2}},{{article.geopt.lat|floatformat:2}}</coordinates></Point>
</Placemark>{% endif %}{% endfor %}
</Document></kml>
I got app id classifiedsmarket and I got a similar issue with KML/KMZ that I
posted about here
http://stackoverflow.com/questions/5483917/how-to-improve-kml-performance
My KML files are http://www.montao.com.br/montaolist and
http://www.koolbusiness.com/list.kml (a superset) and the difficulty appears
with memory longer than 10 days at the moment so it's not very scalable only
displaying the last 10 days when there is lots of more content via the
application that serves 2 domains and sorts KML markers according to domain.
It was mentioned that JSON is a better choice in my case. Could this
discussion also recognize that JSON is and option and tell us more exactly
how?
Sincerely with thanks for more comments,
Niklas
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.