KML/KMZ Load - 500 Internal Server Error

139 views
Skip to first unread message

Tony

unread,
Apr 5, 2011, 12:34:52 PM4/5/11
to Google Maps JavaScript API v3
Hi there, there doesn't seem to be many threads/posts on people having
this issue, but I hope someone has an answer.

I have a KMZ file that is generated on the fly. A typical KMZ file
that is generated will have approximately 16 Placemarks. Each
Placemark will contain a MultiGeometry element, then a single Polygon
element. The Polygon element will have a bunch of children elements,
and the only one I think worth mentioning would be the "coordinates"
one. Each coordinates element contains roughly ~1500 coordinates in
total. The file size of the KMZ is under 500KB usually. And I don't
think I exceed any of the limits stated on
http://code.google.com/apis/kml/documentation/mapsSupport.html.

When I go to create the layer using this KMZ file generator location,
the layer will sometimes not display on my map. If I look in FireBug,
I'll be able to see the request to KmlOverlayService failing and
stating a 500 Internal Server Error. If I then copy the Location for
that request and visit it in a new window, the page will load a bunch
of text which I assume means it's working since it doesn't give me a
500 error anymore. If I now hard refresh my map's web page, the KMZ
layer will load perfectly fine.

Cliffs:
KMZ file seems to be under the limits, but generates a 500 error
intermittently when loading the layer.
When 500 error occurs, accessing KmlOverlayService directly will load
data properly without seeing the 500 error.
The layer seems to be fine as it can load on occasion rather than fail
for every request.

Does anyone know what's going here?

Rossko

unread,
Apr 5, 2011, 12:50:51 PM4/5/11
to Google Maps JavaScript API v3
Maybe your generating process takes too long. Google's servers will
time it out.

Tony

unread,
Apr 5, 2011, 2:49:40 PM4/5/11
to Google Maps JavaScript API v3
Thanks for your suggestion, but when I go to generate it, it takes
less than a second to output the KMZ file. I don't think Google's
server will time it out that quickly.

James McGill

unread,
Apr 5, 2011, 7:55:47 PM4/5/11
to google-map...@googlegroups.com, Tony
To help isolate the problem, can you pre-generate some KML files (to
remove the possibility that the generation time is causing timeouts)
and then try and load each of them?

Regards,
James

> --
> 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 google-map...@googlegroups.com.
> To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

Niklas Rosencrantz

unread,
Apr 7, 2011, 6:52:48 AM4/7/11
to google-map...@googlegroups.com, Tony
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


Tony

unread,
Apr 7, 2011, 12:07:08 PM4/7/11
to Google Maps JavaScript API v3
Hi Niklas,

There's nothing at that first link you posted (montao).
I don't understand what you mean by "difficulty appears with memory
longer than 10 days". Could you please elaborate?

Tony
> posted about herehttp://stackoverflow.com/questions/5483917/how-to-improve-kml-perform...
> My KML files arehttp://www.montao.com.br/montaolistandhttp://www.koolbusiness.com/list.kml(a superset) and the difficulty appears

Stephen Ball

unread,
Apr 11, 2011, 11:04:07 AM4/11/11
to Google Maps JavaScript API v3
I don't know what's going on, but we're intermittently running into
the same issue at http://broadband.com/map. We opened a ticket with
Google on Friday and haven't been able to resolve the issue yet.

The trouble seems to have started on Wednesday or Thursday. About 30%
of the time any of the KML layers will fail to load.

Our map connects with up to four KMZ files hosted on Amazon S3. We've
run load testing against the KMZ files directly and see 0% failure and
very fast response. If we copy the callback URL that the googleapi
creates to talk to the KmlOverlayService into a browser and refresh we
see it flip back and forth from actual data to the 500 server error
page.

I'll update when I have more info.

-- Stephen

On Apr 5, 12:34 pm, Tony <ton.anh...@gmail.com> wrote:
> Hi there, there doesn't seem to be many threads/posts on people having
> this issue, but I hope someone has an answer.
>
> I have a KMZ file that is generated on the fly. A typical KMZ file
> that is generated will have approximately 16 Placemarks. Each
> Placemark will contain a MultiGeometry element, then a single Polygon
> element. The Polygon element will have a bunch of children elements,
> and the only one I think worth mentioning would be the "coordinates"
> one. Each coordinates element contains roughly ~1500 coordinates in
> total. The file size of the KMZ is under 500KB usually. And I don't
> think I exceed any of the limits stated onhttp://code.google.com/apis/kml/documentation/mapsSupport.html.
>
> When I go to create the layer using this KMZ file generator location,
> the layer will sometimes not display on my map. If I look in FireBug,
> I'll be able to see the request to KmlOverlayService failing and
> stating a500InternalServerError. If I then copy the Location for
> that request and visit it in a new window, the page will load a bunch
> of text which I assume means it's working since it doesn't give me a500error anymore. If I now hard refresh my map's web page, the KMZ
> layer will load perfectly fine.
>
> Cliffs:
> KMZ file seems to be under the limits, but generates a500error
> intermittently when loading the layer.
> When500error occurs, accessing KmlOverlayService directly will load

Sabka Traffic

unread,
May 30, 2012, 6:30:38 PM5/30/12
to google-map...@googlegroups.com
Hello Stephan,

Did you resolve your issue?  What was the root cause?

Thanks,

Sabka
Reply all
Reply to author
Forward
0 new messages