OpenLayers 3 - Scale Line不显示'nautical'

时间:2015-03-29 18:36:08

标签: javascript openstreetmap openlayers-3 openseamap

我正在使用OpenLayer3在其他控件旁边显示包含ScaleLine的地图。不幸的是,我能够使用所有可能的比例线单位('度','英制','公制','我们'),但我无法显示('航海')。 我想得到一个暗示,我必须做些什么

谢谢理查德

<!DOCTYPE html>
<html>
    <head>
        <title>Wilde Luzie Map</title>

        <!-- Scripts go here -->
        <script src='http://ol3js.org/en/master/build/ol.js'></script>

        <script src='js/nav_main.js'></script>
        <!-- Styles go here -->
        <link rel='stylesheet' href='http://ol3js.org/en/master/css/ol.css'>

        <style>
            .map{height:800px;width:100%;}

            .ol-mouse-position{background:#9eeeff;background:rgba(158,238,255,.6);top:8px;right:8px;font-size:13px;position:absolute}
            .ol-scale-line{background:#9eeeff;background:rgba(158,238,255,.6);border-radius:4px;bottom:8px;left:40px;padding:2px;position:absolute}
            .ol-scale-line-inner{border:1px solid #000;border-top:none;color:#000;font-size:10px;text-align:center;margin:1px;will-change:contents,width}
            .ol-overviewmap{position:absolute;left:8px;bottom:8px}
        </style>

    </head>

    <body onload="init()">
        <div id='map'></div>
    </body>
</html>

var map;
var lon = 10.80773;
var lat = 54.09416;
var zoomlevel = 15;
var template = 'LatLon: {y}, {x}';

var mousePositionControl = new ol.control.MousePosition({
    coordinateFormat: function(coord) {return ol.coordinate.toStringHDMS(coord);},
    projection: 'EPSG:4326',   
    undefinedHTML: 'Mouse outside'
    });

function init(){
    map = new ol.Map({
          target:  'map',
          renderer:'canvas',
          layers: [new ol.layer.Tile({source: new ol.source.OSM()}),
                   new ol.layer.Tile({source: new ol.source.XYZ({
                   url: 'http://t1.openseamap.org/seamark/{z}/{x}/{y}.png'}) })
                  ],
          view:     new ol.View({
                    center:ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:3857'),
                    zoom:zoomlevel
                    }),
          controls: ol.control.defaults({
                        attributionOptions:({
                        collapsible: false
                        })
                    }).extend([mousePositionControl,
                    new ol.control.OverviewMap({className:'ol-overviewmap'})]),

    });

var rkScaleLine = new ol.control.ScaleLine({
                  className:'ol-scale-line',
                  units:'nautical'});
    map.addControl(rkScaleLine);

var rkLogo = new ol.control.Logo({className:'ol-logo'});
    map.addControl(rkLogo); 

}

0 个答案:

没有答案