Hi,
On Thu, Mar 26, 2009 at 7:56 PM, kngai <[email protected]> wrote:
>
> Currently, OpenLayers.Control.MousePosition only displays the coordinates as
> LON/LAT. I want to inverse that and display it as LAT/LON instead. I can't
> seem to find an option that allows this.
> Is there some of option to do this in Openlayers without having to do some
> custom string manipulation?
You could create your control like this:
var pos = new OpenLayers.Control.MousePosition({
formatOutput: function(lonLat) {
var digits = parseInt(this.numDigits);
var newHtml =
this.prefix +
lonLat.lat.toFixed(digits) +
this.separator +
lonLat.lon.toFixed(digits) +
this.suffix;
return newHtml;
},
});
You can create any custom output by overriding the formatOutput function.
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users