On Sat, Sep 11, 2010 at 1:25 PM, Niklas Rosencrantz <[email protected]> wrote:
>
>
> On Sat, Sep 11, 2010 at 1:21 PM, Joseph Elfelt <[email protected]> wrote:
>>
>> Have you validated your KML file?
>>
>> My app was unable to display your file:
>> http://www.mappingsupport.com/p/gmap4.php?q=http://www.koolbusiness.com/output.kml
>

Thanks for the information now maps.google and feedvalidator could
load the KML output www.koolbusiness.com/output.kml with some
recommendations This is a valid KML 2.2 feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed
readers could be improved by implementing the following
recommendations.

Feeds should not be served with the "text/html" media type [help]

line 1, column 0: Use of unknown namespace:
http://www.google.com/kml/ext/2.2 [help]

<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml ...

line 1, column 221: Placemark should contain a id attribute. This is
important if you want to link directly to features. (20 occurrences)
[help]

Here's how KML is generated

        from django.template import defaultfilters
        start=datetime.datetime.now()-timedelta(days=150)#flex,get or store
        url = os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST')
else os.environ['SERVER_NAME']
        a= Ad.all().filter("modified >", start).filter("published =",
True).order("-modified").fetch(20)
        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 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.

Reply via email to