]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/map.js
Only add the data layer to the main map, and use the visibility changed
[rails.git] / public / javascripts / map.js
index b3d964b5b468e0bffa7ff1b5989a48119c483bcf..9b144c560a5093f6d0852137f7e948dc079dc991 100644 (file)
@@ -7,9 +7,11 @@ OpenLayers._getScriptLocation = function () {
    return "/openlayers/";
 }
 
-function createMap(divName) {
+function createMap(divName, options) {
+   options = options || {};
+
    map = new OpenLayers.Map(divName, {
-      controls: [
+      controls: options.controls || [
          new OpenLayers.Control.ArgParser(),
          new OpenLayers.Control.Attribution(),
          new OpenLayers.Control.LayerSwitcher(),
@@ -18,7 +20,7 @@ function createMap(divName) {
          new OpenLayers.Control.ScaleLine()
       ],
       units: "m",
-      maxResolution: 156543,
+      maxResolution: 156543.0339,
       numZoomLevels: 20
    });
 
@@ -109,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);
 }