[OpenLayers-Users] managing a large number of features

plen peteralen at earthlink.net
Thu Oct 22 17:24:42 EDT 2009


Not sure if this may help in your situation but the first question is to see
if you create your points like the following:

var pstyle = createPointStyle("browser_test_area/marina.png", 20, 20, true);
var point1 = new OpenLayers.Geometry.Point(-42.45, -6.86);
var pointFeature1 = new OpenLayers.Feature.Vector(point1,null,pstyle);
getFeaturesLayer1().addFeatures([pointFeature1]);

where the features layer is a OpenLayers.Layer.Vector layer?

If so, and you don't care about some of the feature controls, like dragging,
you can create your points using the following:

var iconSize =  new OpenLayers.Size(20,20);
var iconOffset = new OpenLayers.Pixel(-((iconSize.w/2) - 3), -iconSize.h);
var iconURL = "browser_test_area/intelligence.png";
var marker = new OpenLayers.Marker(
               new OpenLayers.LonLat("1.58", "7.82"),
               new OpenLayers.Icon(iconURL,iconSize,iconOffset));
getMarkersLayer().addMarker(marker);

where the markers layer is a OpenLayers.Layer.Markers layer.  Adding points
to the map in this manner is MUCH, MUCH quicker.  You can still add event
handlers like mouseclicks as well, but these done via the marker, not the
layer.

- Peter



Altair wrote:
> 
> Hi all.
> 
> I have about 2000 points. When I add these points to the vector layer over
> GeoJSON MultiPoint, map begins work very slowly.
> Does OL points manager like MarkerManager in Google API ? Which show
> points on the layer, depending on map zoom.
> 
> Thanks.
> 

-- 
View this message in context: http://n2.nabble.com/managing-a-large-number-of-features-tp3844771p3875116.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list