[OpenLayers-Users] Bounds / Projection

Alexandre Dube adube at mapgears.com
Mon Sep 21 11:53:13 EDT 2009


Hi,

  A small trick to get an extent : use the MousePosition control [1], 
then set your map extent using the setCenter [2] method or zoomToExtent [3].

[1] http://openlayers.org/dev/examples/mouse-position.html
[2] 
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.setCenter
[3] 
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.zoomToExtent

Hope this helps,

Alexandre

eoinyp wrote:
> Thank you Alexandre,
> I now realise that the (-180,-90,180,90) system wont work because Im using
> EPSG:900913, spherical mercator, which is where The projection
> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508.34)
> comes in.
> Thank you.
> But Im still stuck as to how to set the map to focus on Ireland. I dont
> understand how to define the bounds of a suitable box. Can you give me any
> pointers there?
> Thanks,
>
> Eoinyp.
>
>
>   

-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list