Google Maps KmlLayer Service choking (error 500) on server output

207 views
Skip to first unread message

Clint Tseng

unread,
Jul 25, 2011, 3:38:18 PM7/25/11
to google-map...@googlegroups.com
Our web application serves up, among many other things, plain files, many of which are KML. We'd like developers to be able to load those KML files directly into their own applications via the v3 API. Unfortunately, when the JS library calls the KmlOverlayService on maps.googleapis.com, 2 out of 3 times Google chokes and gives me a 500 response instead.

If I download the file using curl, wget, or a web browser (which always works correctly), then load it onto a really dumb Apache server (a DreamHost account, actually), and use the same maps API code except with the new URL, it always works.

The endpoint on Google's side that's returning a 500 is here:

The JS code is basically directly lifted off the example:

/* skipping boilerplate setup and options */
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  pd.setMap(map);

Here are the headers when I download the file directly from our web application (does not work very consistently):

* About to connect() to data.cityofchicago.org port 80 (#0)
*   Trying 216.227.229.145... connected
* Connected to data.cityofchicago.org (216.227.229.145) port 80 (#0)
> GET /api/file_data/kO8U6PvC3a4GV0FnVqozbV_iOMUSNxn6FCMqvMouW_U?filename=Kmlpolicedistricts.kml HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Accept: */*
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
< Date: Mon, 25 Jul 2011 19:14:05 GMT
< Server: Apache
< Content-disposition: inline; filename=Kmlpolicedistricts.kml
< Cache-Control: private, max-age=1209600
< Expires: Mon, 08 Aug 2011 12:14:05 -0700
< Content-Length: 1452383
< Vary: Accept-Encoding,User-Agent
< Connection: close
< Content-Type: application/xml;charset=us-ascii
{ [data not shown]
100 1418k  100 1418k    0     0   239k      0  0:00:05  0:00:05 --:--:--  245k
* Closing connection #0

And here they are when I download them off my DreamHost account (works consistently):

clint@Durindana:~$ curl -v http://dontexplain.com/upload/police.xml > /dev/null                                                                                                                                        [/Users/clint|12:14]
* About to connect() to dontexplain.com port 80 (#0)
*   Trying 69.163.151.44... connected
* Connected to dontexplain.com (69.163.151.44) port 80 (#0)
> GET /upload/police.xml HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Accept: */*
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
< Date: Mon, 25 Jul 2011 19:14:55 GMT
< Server: Apache
< Last-Modified: Fri, 22 Jul 2011 18:43:13 GMT
< ETag: "a61863b-16295f-4a8acd679f240"
< Accept-Ranges: bytes
< Content-Length: 1452383
< Content-Type: application/xml
{ [data not shown]
100 1418k  100 1418k    0     0  1080k      0  0:00:01  0:00:01 --:--:-- 1114k* Connection #0 to host dontexplain.com left intact

* Closing connection #0

Does anybody (hopefully someone on the Google team who can look through their logs) have any idea what might be the culprit here? The 500 error has nothing very helpful attached to it.

Thanks.

Rossko

unread,
Jul 25, 2011, 5:09:51 PM7/25/11
to Google Maps JavaScript API v3

Clint Tseng

unread,
Jul 25, 2011, 5:25:07 PM7/25/11
to google-map...@googlegroups.com
Hi Rossko:

Thanks for the response. I did see that thread, but our server always responds in almost exactly 5.85 seconds, since this is how quick the file will return when capped at our internal outbound bandwidth cap, which didn't seem unreasonable to me. Is that still too long?

Thanks,
Clint

Andrew Leach

unread,
Jul 25, 2011, 6:41:39 PM7/25/11
to google-map...@googlegroups.com

I consistently get 6.25s.

What do you think about this response in the thread you refer to, from
James McGill (who has a google.com email address)...?

> "Ideal download times would be under 1 second."

Clint Tseng

unread,
Jul 25, 2011, 7:22:22 PM7/25/11
to google-map...@googlegroups.com, andrew....@gmail.com
That's a valid point; I either glossed over that because it said "ideal" or missed it entirely. Thanks.

I'm not sure we can provide a solution for that, but that's outside the scope of this list. Thanks for the responses, everyone.

Best,
Clint

Barry Hunter

unread,
Jul 26, 2011, 4:58:36 AM7/26/11
to google-map...@googlegroups.com
Yes that is probably too slow :)

Google often aborts, if the the time to build the connection takes
over 3 seconds. It will always timeout after 10 seconds.

You need to start sending data (perhaps your KML header is static) -
in php can use flush() - as soon as possible.


(Or could use an intermedia proxy - that speeds up the download. there
are a myriad of options for CDNs you could use)

> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-maps-js-api-v3/-/vJco5ZCPRwgJ.
> 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.
>

Reply all
Reply to author
Forward
0 new messages