On Friday, September 24, 2010, <[email protected]> wrote:
> Hi,
>
> I have a simple map application that displays a map in EPSG:27700 (British
> National Grid). I'd like to display the mouse position in lat/long, but it's
> displaying in eastings/northings.
>
> Can someone please tell me how I can do this without changing the project of
> my WMS layer? My code is below.
>
> Cheers,
>
> Petrus
>
>
> var panel, slider;
> OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
>
> Ext.onReady(function() {
>
> //bounds of UK
> var bounds = new OpenLayers.Bounds(0, 0, 700000, 1300000);
>
> var options = {
> controls: [
> new OpenLayers.Control.Navigation(),
> new OpenLayers.Control.LayerSwitcher(),
> new OpenLayers.Control.ScaleLine(),
> new OpenLayers.Control.MousePosition(),
> new OpenLayers.Control.PanZoomBar()
> ],
> maxExtent: bounds,
> resolutions: [2000, 1000, 500, 200, 100, 50, 25, 10, 5, 2, 1],
> numZoomLevels: 11,
> projection: "EPSG:27700",
> units: 'm'
> };
>
> mapPanel = new GeoExt.MapPanel({
>
> title: "Map Viewer",
> renderTo: "map-container",
> height: 500,
> width: 600,
>
> map: new OpenLayers.Map('map', options),
>
> layers: [
>
> //Base layers
> new OpenLayers.Layer.WMS(
>
> "Base Layer", "http://XXXXXX/geoserver/wms",
> {
> layers: 'mybaselayer',
> srs: 'EPSG:27700',
> styles: '',
> format: 'image/png',
> tiled: 'true',
> tilesOrigin : "0,0",
> isBaseLayer: "true",
> visibility: "true"
> },
> {buffer: 1}
> ),
>
> ],
>
> });
>
> });
Load the proj4js lib in your page, and set "displayProjection" to "new
OpenLayers.Projection('EPSG:4326')" in the Map or MousePosition
options.
Cheers,
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users