[OpenLayers-Dev] feature.geometry.bounds and feature.bounds

François Van Der Biest francois.vanderbiest at camptocamp.com
Fri Sep 4 09:46:52 EDT 2009


Hi list,

Sometimes, we have to read some geodata in which the bounds are
explicitly given (eg: GeoJSON, GML, and so on).
This is cool because we don't have to compute it client-side.

It also happens that we have no geometry but bounds.
In this case, using Format.GML, I've had to patch OpenLayers to make
it work again, see for instance http://trac.openlayers.org/ticket/2255

The underlying question for this patch is : "is it reasonnable to add
a bounds property to a feature when we have no geometry ?"
Eric says it's fine, but I'd like your opinion on this.

Going further, one could ask: what if we have to read geodata in which
the geometry and the bounds exist ?
Should these explicit bounds go to feature.geometry.bounds or to
feature.bounds, or to both ?

As of today, these bounds go to feature.geometry.bounds, but one could
imagine that the server fails in calculating the correct bounds (OK, I
have to admit that there's very little chance for this).
Therefore, I propose that explicit bounds go to feature.bounds, while
calculated bounds go to feature.geometry.bounds

We could then imagine a feature.getBounds() accessor, which would
return feature.bounds if it exists, else feature.geometry.getBounds().
This method could also have an option to force the computing of bounds
from the geometry.

What's your opinion on this ?

Thank's,
F.



More information about the Dev mailing list