[OpenLayers-Users] Browser hang on large KML markers layer.

Christopher Schmidt crschmidt at metacarta.com
Wed Jun 4 07:52:38 EDT 2008


On Wed, Jun 04, 2008 at 11:45:31AM +0000, barney holmes wrote:
> >On Tue, Jun 03, 2008 at 01:04:47PM +0000, barney holmes >wrote:
> >> The larger KML file that I use is 3.5 mb.
> 
> > Loading 3.5 MB of XML into a browser is simply not going to 
> > work. You'll
> > have to find a different solution.
> 
> > Browsers just don't deal well with XML that big. Just getting the 
> > XML
> > out is a lion's share of the time (determined by profiling). 
> 
> Thanks, but I don't really understand your statement. Google Earth can
> load huge KML layers, although I think it might be using some kind of
> scaling.  See...
> 
> http://maps.google.co.uk/?ie=UTF8&ll=13.923404,-7.03125&spn=170.980165,360&t=h&z=1&lci=lmc:panoramio,lmc:wikipedia_en


1. That's Google Maps, not Google Earth.
2. That's not a KML layer.
3. Google loads all KML to a server, and delivers only compacted JSON to
the client, not XML, so XML parsing size is not involved.

If you want to involve a server, you can do many things that you can't
without a server. 

> If OL cannot load large KML layers is there anything already in the code I can use ? Or maybe future development will include a scaling function for large layers ?

Large XML files *can not be parsed by the browser*: OpenLayers can not
cahnge this. The answer to this is to change it so that you are not
loading large KML files. Simplify your geometries, load based on visible
bounding box/area, etc. etc. There are many optimizations to the way you
load data from the server -- loading 4 MB of XML is simply not going to
work in a browser.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list