[OpenLayers-Users] Problem zooming to feature

Gery . gamejihou at hotmail.com
Tue Mar 5 06:08:22 PST 2013


>    .... part of the code which centers the view on the feature...
>    map.setCenter(new
> OpenLayers.LonLat(feature.geometry.getBounds().getCenterLonLat()).transform(new
> OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()), 18);

if you're working only in EPSG:4326, the transformation is not needed. Try these ones:

map.setCenter(myfeatures.getCenterLonLat(),10);
map.zoomToExtent(myfeatures);
map.zoomToScale(216672);
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130305/abe9a651/attachment.html>


More information about the Users mailing list