Hello folks,

Yesterday I got a nice trick from Arnd about zooming all features 
(points/polylines/polygons). Now I would like to ask about zooming features 
according to their sizes. Imagine this case, I have a point and a big polygon 
that I want to zoom in (also center in the map), the point is too smaill so I 
need to set a specific zoom level for this, this works well for the point case 
inside my variable "myfeatures":

var myfeatures = feature.geometry.bounds;
map.setCenter(myfeatures.getCenterLonLat(),10);

where 10 is the zoom level. However, this doesn't work when the stored feature 
is a big polygon for instance. I was thinking about a simple if/else to do 
this, but how can I differentiate between points, polylines and polygons? a 
couple of things I tried:

map.zoomToExtent(myfeatures);
map.zoomToScale(216672);

but this is kind of a static zooming, so it fails when the feature is too big 
and goes beyond this zoom of 216672.

Any idea is much appreciated,

Best regards,

Gery 

__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es 
necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es 
NICHT, wenn es NICHT notwendig ist.
                                          
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to