<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19088"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN lang=DE>
<P><SPAN class=656153718-23062011>try this:</SPAN></P>
<P></SPAN>var new_cent = map.zoomToExtent(bounds.getCenterLonLat()<SPAN 
class=656153718-23062011>)</SPAN>;</P></DIV>
<DIV><SPAN class=656153718-23062011><FONT color=#0000ff size=2 
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Nicholas 
Efremov-Kendall<BR><B>Gesendet:</B> Donnerstag, 23. Juni 2011 
19:25<BR><B>An:</B> users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] 
re set map center,or specify zoom level with 
mapzoomtoextent<BR></FONT><BR></DIV>
<DIV></DIV>Hi all,
<DIV><BR></DIV>
<DIV>wanted to solicit some advice from the community. I'm working on a simple 
dynamic app I wanted to ask about the best method to approach this.</DIV>
<DIV><BR></DIV>
<DIV>the app sets an arbitrary point, which I suppose could simply be changed to 
zoomtomaxextent, but re-centers the map once the user has agreed to opt-in to 
being geolocated. The issue is that the bounds of the single marker are much 
smaller than the 50km search radius of the script</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>var bounds = marker.getDataExtent();</DIV>
<DIV>map.zoomToExtent(bounds);</DIV></DIV>
<DIV><BR></DIV>
<DIV>I don't want the map to recenter the bounds with every additionally added 
point (nearby tweets), which I feel contributes to a poor UI. How could I get 
the centerlonlat of the marker layer? I'm trying this method and it isn't 
working</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>var bounds = marker.getDataExtent();</DIV>
<DIV>var new_cent = map.zoomToExtent(bounds).getCenterLonLat();</DIV>
<DIV>map.setCenter(new OpenLayers.LonLat(new_cent).transform(new 
OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),2);</DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV></DIV></BODY></HTML>