dequan chen wrote: > hi all, > I overlay Vector Layer to the map to monitor vehicles. every 5 second, > update the location. I use vector layer as vehicle marker. > > Vehicle.vehicleLayer = new OpenLayers.Layer.Vector("", > { > styleMap: new OpenLayers.StyleMap({ > "default": { > externalGraphic: "img/v1.gif", > graphicWidth: 24, > graphicHeight: 12, > graphicYOffset: -5, > rotation: "${angle}", > label: "${vno}", > fontSize: "11px", > fontColor: "purple", > labelAlign: "${align}", > fontFamily: "Arial,Verdana", > } > }) > }); > > the problem is, the vector layer contains almost 500 features stand for 500 > vehicles. when i zoom the map, the browser can nearly not work. user should > wait 1 or 2 minutes or even more. but when i zoom the district that only > monitor dozens of vehicles, pan or zoom the map will be normal. In the > future, the vehicle number will reach to 1000. > Is there any solution to this problem ? It is very ergent to me. thanks. >
You'll get better performance if you avoid using rotation in a point symbolizer. This is very handy for limited numbers of features, but can become a bottleneck for rendering large quantities of features. A workaround is to pre-rotate your graphics, and have the externalGraphic property set based on some feature attribute (e.g. `rotation / 10 | 0`). You could also likely increase performance by not labeling all of your features. If you hope to eventually display 1000 vehicles, I doubt things will look nice with 1000 labels anyway. Displaying vehicle information based on mouse events (mouseover, click) may scale better than labeling all features. Without profiling your application it's tough to get too much more specific about where you could improve performance. Tim > > > ------------------------------------------------------------------------ > > _______________________________________________ > Dev mailing list > Dev@openlayers.org > http://openlayers.org/mailman/listinfo/dev -- Tim Schaub OpenGeo - http://opengeo.org Expert service straight from the developers. _______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev