Add a scale control to the map. Closes #51.
This commit is contained in:
parent
4e05d2af72
commit
2b35dadd5f
1 changed files with 10 additions and 8 deletions
|
@ -5,19 +5,21 @@ var popup;
|
||||||
OpenLayers._getScriptLocation = function () {
|
OpenLayers._getScriptLocation = function () {
|
||||||
return "/openlayers/";
|
return "/openlayers/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMap(divName) {
|
function createMap(divName) {
|
||||||
map = new OpenLayers.Map(divName, {
|
map = new OpenLayers.Map(divName, {
|
||||||
controls: [
|
controls: [
|
||||||
new OpenLayers.Control.ArgParser(),
|
new OpenLayers.Control.ArgParser(),
|
||||||
new OpenLayers.Control.Attribution(),
|
new OpenLayers.Control.Attribution(),
|
||||||
new OpenLayers.Control.LayerSwitcher(),
|
new OpenLayers.Control.LayerSwitcher(),
|
||||||
new OpenLayers.Control.Navigation(),
|
new OpenLayers.Control.Navigation(),
|
||||||
new OpenLayers.Control.PanZoomBar()
|
new OpenLayers.Control.PanZoomBar(),
|
||||||
]
|
new OpenLayers.Control.ScaleLine()
|
||||||
|
],
|
||||||
|
units: "m"
|
||||||
});
|
});
|
||||||
|
|
||||||
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
|
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
|
||||||
displayOutsideMaxExtent: true,
|
displayOutsideMaxExtent: true,
|
||||||
wrapDateLine: true
|
wrapDateLine: true
|
||||||
});
|
});
|
||||||
|
@ -29,14 +31,14 @@ function createMap(divName) {
|
||||||
});
|
});
|
||||||
map.addLayer(osmarender);
|
map.addLayer(osmarender);
|
||||||
|
|
||||||
var maplint = new OpenLayers.Layer.OSM.Maplint("Maplint", {
|
var maplint = new OpenLayers.Layer.OSM.Maplint("Maplint", {
|
||||||
displayOutsideMaxExtent: true,
|
displayOutsideMaxExtent: true,
|
||||||
wrapDateLine: true
|
wrapDateLine: true
|
||||||
});
|
});
|
||||||
map.addLayer(maplint);
|
map.addLayer(maplint);
|
||||||
|
|
||||||
var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels);
|
var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels);
|
||||||
markers = new OpenLayers.Layer.Markers("Markers", {
|
markers = new OpenLayers.Layer.Markers("Markers", {
|
||||||
displayInLayerSwitcher: false,
|
displayInLayerSwitcher: false,
|
||||||
numZoomLevels: numZoomLevels,
|
numZoomLevels: numZoomLevels,
|
||||||
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
|
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue