Hello
to view datalayer geopt=db.GeoPtProperty(verbose_name="geopt")
after switch to kml quite pleased wecomes any general or specific
constructive feedback or recommendations especially the CDATA part
which appears handle diff between javascript and html escapes.
http://www.koolbusiness.com/output.kml
serverside:
start=datetime.datetime.now()-timedelta(days=3)#flexify relative max
        url = os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST')
else os.environ['SERVER_NAME']
        a= Ad.all()
        a.filter("published =", True)
        a.filter("modified >", start)
        self.response.out.write('<?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 ad in a:
            if ad.geopt:
                if ad.matched_images.get():
                    imageid=ad.matched_images.get().key().id()
                    kml = ('<Placemark><name></name><description><!
[CDATA[<img src="http://%s/images/%d.%s";> %s ]]></
description><Style><IconStyle><Icon><href>http://www.google.com/intl/
en_us/mapfiles/ms/icons/green-dot.png</href></Icon></IconStyle></
Style> <Point><coordinates>%d,%d</coordinates></Point></Placemark>'
           ) %(url,ad.matched_images.get().key().id
(),ad.matched_images.get().full_ext,'<a href="http://'+url+'/'+str
(ad.key().id())+'">'+ad.title+'</a><br/>       '+defaultfilters.urlize
(  defaultfilters.truncatewords(  ad.text ,
20 )  ),ad.geopt.lon,ad.geopt.lat)
                else:
                    kml = ('<Placemark><name></name><description><!
[CDATA[%s]]></description><Style><IconStyle><Icon><href>http://
www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png</href></Icon></IconStyle></Style>
<Point><coordinates>%d,%d</coordinates></Point></Placemark>'
           ) %('<a href="http://'+url+'/'+str(ad.key().id())
+'">'+ad.title+'</a><br/>'+defaultfilters.urlize
(  defaultfilters.truncatewords( defaultfilters.striptags
(  ad.text ) , 20 )  ),ad.geopt.lon,ad.geopt.lat)
                self.response.out.write(kml)
        self.response.out.write( '</Document></kml>')

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to