tags:

views:

110

answers:

1

This is very fast in all browsers:

var curLayer = new OpenLayers.Layer.Text("layer", { location: "test.txt"});
map.addLayer(curLayer);

However, the following code is fast in Firefox and Chrome, but incredibly slow in IE8 (loading 500 features takes 30 minutes!):

var curLayer = new OpenLayers.Layer.Vector("layer", {
    protocol: new OpenLayers.Protocol.HTTP({
        url: "test.txt",
        format: new OpenLayers.Format.Text()
    })
});
map.addLayer(curLayer);

By number of reasons I'd prefer to use OpenLayers.Layer.Vector, but cannot due to the IE performance issue.

Does anybody know a good solution? Finally I need to load on a map a lot of clickable point features with customizable popups.

+1  A: 

When you are using Layer.Text, the marker symbols are rendered by using html+embedded marker symbols. With a vector layer, the symbols are drawn as vector graphics (svg and/or vml). Since IE has a very poor vector rendering performance, the openlayers wiki recommends using a maximum of 50 Markers in IE 6 (http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#WhyisMyMapSluggishwhenIAdd500Markers).

I'd recommend to use Openlayer's POI Clustering Strategy (http://openlayers.org/dev/examples/strategy-cluster.html) to reduce the number of Markers in larger scales. When the user zooms in, all markers appear again.

Franz
I already tried several strategies (cluster, paging), but displaying all markers on the map at the same time is required. Next time I'll definitely use the server side technique (WMS/WFS) instead of adding tons of markers on the map. And your explanation about difference between text and vector layers was clear. Thanks.
Zenya