to load a base WMS layer and a KML file on it. The problem is that I
want to display the map just arround the bounding box of the KML file
but the method getDataExtent only returns something usefull when the
method has returned. Some ideias ?

Yep. The Vector layer loading is asynchronous; at the time you add the layer to the map, the data isn't ready. So, have the Layer catch the "loadend" event, and have it respond to its freshly-loaded data *after* it has loaded.

vectorlayer.events.register('loadend', vectorlayer, function () {
   map.zoomToExtent( this.getDataExtent() );
});


--
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: [email protected]
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-enewsletter, at www.GreenInfo.org
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to