Missing CSS was confirmed with issue #680, this commit is to fix it and change ol-mouse-position class to ol-mouseposition. I choose for the moment the top right corner to display the coordinates from mouse position control because of potential conflict with the scaleline control.
34 lines
863 B
JavaScript
34 lines
863 B
JavaScript
goog.require('ol.Map');
|
|
goog.require('ol.RendererHints');
|
|
goog.require('ol.View2D');
|
|
goog.require('ol.control.MousePosition');
|
|
goog.require('ol.control.defaults');
|
|
goog.require('ol.coordinate');
|
|
goog.require('ol.layer.TileLayer');
|
|
goog.require('ol.source.OSM');
|
|
|
|
|
|
var map = new ol.Map({
|
|
controls: ol.control.defaults({}, [
|
|
new ol.control.MousePosition({
|
|
coordinateFormat: ol.coordinate.toStringHDMS,
|
|
projection: 'EPSG:4326',
|
|
// comment the following line to have the mouse position
|
|
// be placed within the map.
|
|
target: document.getElementById('mouse-position'),
|
|
undefinedHTML: ' '
|
|
})
|
|
]),
|
|
layers: [
|
|
new ol.layer.TileLayer({
|
|
source: new ol.source.OSM()
|
|
})
|
|
],
|
|
renderers: ol.RendererHints.createFromQueryData(),
|
|
target: 'map',
|
|
view: new ol.View2D({
|
|
center: [0, 0],
|
|
zoom: 2
|
|
})
|
|
});
|