我正在使用以下控件在OpenLayers 3中显示鼠标位置
var mousePositionControl = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(2),
projection: 'EPSG:4326',
undefinedHTML: ' '
});
但是结果显示鼠标的位置为Lon,Lat而不是Lat,Lon。
这是一个jsfiddle示例。
我如何才能颠倒顺序,以便它是Lat,Lon?
对我来说,添加各种控件(包括Lat,Long)的方法是:
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()
];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句