<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=136310320-04042011>what means "</SPAN>it
doesn´t work as I expected<SPAN class=136310320-04042011>"?</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=136310320-04042011></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=136310320-04042011><FONT color=#0000ff
size=2 face=Arial>as your map is in EPSG:900913, you will not get any reasonable
result by transforming these coordinates from EPSG:4326 to
EPSG:900913.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=136310320-04042011><FONT color=#0000ff
size=2 face=Arial><BR>Arnd</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=136310320-04042011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=136310320-04042011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><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>Robert
Buckley<BR><B>Gesendet:</B> Montag, 4. April 2011 18:52<BR><B>An:</B>
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] how to return
getcenter and getextent?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV
style="FONT-FAMILY: arial,helvetica,sans-serif; COLOR: #40007f; FONT-SIZE: 10pt">Hi,<BR><BR>I
want to call the extent and center of my openlayers map and put the results in a
msgbox. Unfortunately i´m missing something because it doesn´t work as I
expected.<BR><BR>Could someone explain how to simply get the extents and center
of the current view? The map is in 900913<BR><BR>var map;<BR><BR>var extent =
new OpenLayers.Bounds(10.0, 51.8, 10.8, 52.8).transform(<BR>
new
OpenLayers.Projection(epsg4326), // transform from WGS
1984<BR>
new OpenLayers.Projection(epsg900913) // to Spherical
Mercator Projection<BR> );<BR><BR>
<DIV>var mapOptions =
{<BR>
projection:
epsg900913,<BR>
displayProjection: new
OpenLayers.Projection(epsg4326),<BR>
units:
"m",<BR>
minScale: 1000,<BR>
maxResolution: 156543,
<BR>
maxExtent: new OpenLayers.Bounds(1092438.008103, 6799532.287192, 1245312.064646,
6921831.532427),<BR>
controls: [ <BR>
new OpenLayers.Control.MouseDefaults(),
<BR>
new
OpenLayers.Control.PanZoomBar(), <BR>
new
OpenLayers.Control.ScaleLine({<BR>
maxWidth:
200,<BR>
geodesic:
true<BR>
})]<BR>
};<BR> <BR>map = new
OpenLayers.Map("map_wea",mapOptions);<BR><BR>// my base map<BR>var mapnik = new
OpenLayers.Layer.OSM();<BR><BR><BR>// messagebox to display info about
map<BR><BR>var latlon = map.getCenter();<BR>
var currentlatlon = new
OpenLayers.LonLat(latlon).transform(<BR>
new
OpenLayers.Projection(epsg4326), // transform from WGS
1984<BR>
new OpenLayers.Projection(epsg900913) // to Spherical
Mercator Projection<BR>
);<BR>
<BR>
var mapextent =
map.getExtent();<BR>
var currentmapextent= new
OpenLayers.Bounds(mapextent).transform(<BR>
new
OpenLayers.Projection(epsg4326), // transform from WGS
1984<BR>
new OpenLayers.Projection(epsg900913) // to Spherical
Mercator Projection<BR>
);<BR>
<BR>
Ext.Msg.alert('bounds',
currentmapextent + " / " + currentlatlon);<BR></DIV></DIV></BODY></HTML>