Multiple KMLs & 414 Error Request-URI Too Large

321 views
Skip to first unread message

Tony

unread,
Mar 30, 2011, 2:42:16 PM3/30/11
to Google Maps JavaScript API v3
Hi there, I'm experiencing a problem where if create more than 15
KmlLayers using the constructor and passing in different KML files for
each, there seems to be a bunch of failed requests shown in FireBug
with the 414 Error Request-URI Too Large.

At exactly 15 KmlLayers, the map works as expected. But once I go over
this magical number, the polygon regions as defined in each KML file
fail to show. However, the markers I have created inside the
"metadata_changed" event listener for each individual layer still
shows properly. It is only the polygon that has trouble displaying
which I assume is the tile returned from Google's servers after the
request. The failed requests seem to be ones that are directed at the
googleapis.com domain. I've tried copying the request location and
counting the characters, and they all seem to be above 2048 which I
think is the cut off.

I've looked to see if anyone has encountered the same issue and there
seems to be an unresolved post on Stack Overflow as seen here:
http://stackoverflow.com/questions/5120823/multiple-kmls-and-414-error-request-uri-too-large
This post is pretty much exactly what I'm experiencing too.

Does anyone know of a proper workaround to this?

Barry Hunter

unread,
Mar 30, 2011, 4:16:08 PM3/30/11
to google-map...@googlegroups.com
There probably isnt a direct way to overcome it. GMaps is going to try displaying them all at once. 

But possible ways to work around it:

Do you always load the same combination of KML layers? Can you create a single (or fewer) KML file, that are simply network links to the original files?

You could also maybe make a handler that accepted parameters on what KML files to load, and outputted the relevent files as a network links. 



--
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.


Tony

unread,
Mar 30, 2011, 5:25:09 PM3/30/11
to Google Maps JavaScript API v3
I do not load the same combination of KML layers. In fact, it's
dependent on the user's input in a way.

I am able to create a single KML file which contains Polygon
definitions and coordinates from merging all 15+ of the single KML
files. However, my issue with this is that I also have Markers placed
in the center of each Polygon after it renders.

Specifically, I'll have a listener on the "metadata_changed" event for
each of the 15+ single KmlLayers. Then once that fires, I'll create a
Marker setting its position to "this.getDefaultViewport().getCenter()"
which refers to the layer. I pretty much only need the center point
from that layer now that I can generate a KML file on the fly of all
the merged KMLs that the user selects. I've tried not calling the
layer.setMap(myMap) function, but this means that the
"metadata_changed" event never fires. So then I decided to remove the
layer after its "metadata_changed" event fires. This results in a LOT
of requests to google since it has to request to create, then remove.
This method seems to work, but it's very slow due to the large amount
of requests.

Cliffs: Can merge all KMLs into a single KML file, but now can't get
center using layer.getDefaultViewport().getCenter() to set Marker's
position for that "single" KML area.

Thanks for your help so far Barry.

On Mar 30, 2:16 pm, Barry Hunter <barrybhun...@gmail.com> wrote:
> There probably isnt a direct way to overcome it. GMaps is going to try
> displaying them all at once.
>
> But possible ways to work around it:
>
> Do you always load the same combination of KML layers? Can you create a
> single (or fewer) KML file, that are simply network links to the original
> files?
>
> You could also maybe make a handler that accepted parameters on what KML
> files to load, and outputted the relevent files as a network links.
>
> On 30 March 2011 19:42, Tony <ton.anh...@gmail.com> wrote:
>
> > Hi there, I'm experiencing a problem where if create more than 15
> > KmlLayers using the constructor and passing in different KML files for
> > each, there seems to be a bunch of failed requests shown in FireBug
> > with the 414 Error Request-URI Too Large.
>
> > At exactly 15 KmlLayers, the map works as expected. But once I go over
> > this magical number, the polygon regions as defined in each KML file
> > fail to show. However, the markers I have created inside the
> > "metadata_changed" event listener for each individual layer still
> > shows properly. It is only the polygon that has trouble displaying
> > which I assume is the tile returned from Google's servers after the
> > request. The failed requests seem to be ones that are directed at the
> > googleapis.com domain. I've tried copying the request location and
> > counting the characters, and they all seem to be above 2048 which I
> > think is the cut off.
>
> > I've looked to see if anyone has encountered the same issue and there
> > seems to be an unresolved post on Stack Overflow as seen here:
>
> >http://stackoverflow.com/questions/5120823/multiple-kmls-and-414-erro...

Tony

unread,
Mar 30, 2011, 5:26:37 PM3/30/11
to Google Maps JavaScript API v3
Oops, I accidentally clicked the "Report messages as spam button". :(
Message has been deleted

Emil Egredžija

unread,
Mar 3, 2012, 4:37:38 PM3/3/12
to google-map...@googlegroups.com
have you found any resolution to this problem ?

I have the same problem with V3 API, where more then cca. 15 kml layers couse the error "NetworkError: 414 Request-URI Too Large".

different kml layers are displayed with "new google.maps.KmlLayer( kml_url, options)".

Every object (route or marker) is on its own kml layer, because it has to get dynamicaly assigned event listener.
If i group more objects into single KML, i dont know how to manipulate single object before displaying it on the map.

Tnx.
Emil
> > google-maps-js-api-v3@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-maps-js-api-v3+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages