在OpenLayers 3中格式化MousePosition控件的输出

sfletche

我正在使用以下控件在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()
];
(摘自 《 openlayers 3》

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章