X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/db30a423a8f923bbcae709e1c8f6e337f637bc9a..4d8ea0eed0d47b3547f222fbc47524328bbd23a7:/public/javascripts/map.js?ds=sidebyside diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 0dadbb9d3..9b144c560 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -8,7 +8,8 @@ OpenLayers._getScriptLocation = function () { } function createMap(divName, options) { - if (!options) { options = {} } + options = options || {}; + map = new OpenLayers.Map(divName, { controls: options.controls || [ new OpenLayers.Control.ArgParser(), @@ -19,7 +20,7 @@ function createMap(divName, options) { new OpenLayers.Control.ScaleLine() ], units: "m", - maxResolution: 156543, + maxResolution: 156543.0339, numZoomLevels: 20 }); @@ -110,6 +111,10 @@ function setMapExtent(extent) { map.zoomToExtent(extent.clone().transform(epsg4326, map.getProjectionObject())); } +function getMapExtent(extent) { + return map.getExtent().clone().transform(map.getProjectionObject(), epsg4326); +} + function getEventPosition(event) { return map.getLonLatFromViewPortPx(event.xy).clone().transform(map.getProjectionObject(), epsg4326); }