[OpenLayers-Users] Layer.GML.features.length

Tim Schaub noreply at geocartic.com
Thu Jun 7 12:03:56 EDT 2007

Jeff Dege wrote:
> I'm creating a GML layer from a GML file.
> I want the map to zoom to the smallest box bounding all the features in
> the GML file.
> What I've tried is:


> 	var minx = 999999;
> 	var miny = 999999;
> 	var maxx = -999999;
> 	var maxy = -999999;

As an aside, 999999 may look like a big number, but it isn't always. 
Better to use Number.POSITIVE_INFINITY and Number.NEGATIVE_INFINITY here.


> Seems to me the best hook, for dealing with these sorts of issues, might
> be a doneInsertingFeatures() callback.  Added after the end of the loop
> in Layer\Vector.js.

I agree, I think layers that load data asynchronously should call a 
doneLoading callback that you can define in the layer options.

I'd suggest making a ticket if nobody else has a better workaround.


More information about the Users mailing list