I'm showing the mouse position in OpenLayers 3 with the following control
var mousePositionControl = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(2),
projection: 'EPSG:4326',
undefinedHTML: ' '
});
But the result shows the mouse position as Lon,Lat rather than Lat,Lon.
Here's a jsfiddle example.
How can I reverse the order so that it's Lat,Lon?
What works for me to add a variety of controls incl Lat, Long is:
var controls = [
new ol.control.Attribution(),
new ol.control.MousePosition({
projection: 'EPSG:4326',
coordinateFormat: function(coordinate) {
return ol.coordinate.format(coordinate, '{y}, {x}', 4);
}
}),
new ol.control.ScaleLine(),
new ol.control.Zoom(),
new ol.control.ZoomSlider(),
new ol.control.ZoomToExtent(),
new ol.control.FullScreen()
];