diff options
Diffstat (limited to 'chimere/static/main_map.js')
-rw-r--r-- | chimere/static/main_map.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/chimere/static/main_map.js b/chimere/static/main_map.js index 66ed27f..8d10185 100644 --- a/chimere/static/main_map.js +++ b/chimere/static/main_map.js @@ -177,8 +177,9 @@ function loadLayersFromJSON(layer_markers, layer_vectors, geo_objects){ } /* zoom to an area */ -function zoomToArea(top, left, bottom, right){ +function zoomToArea(left, top, right, bottom){ var bounds = new OpenLayers.Bounds(left, bottom, right, top); + bounds.transform(epsg_display_projection, epsg_projection); map.zoomToExtent(bounds, true); loadCategories(); } @@ -431,19 +432,12 @@ function createParams(center, zoom, layers) { // Break out of this function, and simply return the params from the // base link. if (center) { + center.transform(epsg_projection, epsg_display_projection); //zoom params.zoom = zoom || this.map.getZoom(); //lon,lat var lat = center.lat; var lon = center.lon; - if (this.displayProjection) { - var mapPosition = OpenLayers.Projection.transform( - { x: lon, y: lat }, - this.map.getProjectionObject(), - this.displayProjection ); - lon = mapPosition.x; - lat = mapPosition.y; - } params.lat = Math.round(lat*100000)/100000; params.lon = Math.round(lon*100000)/100000; //layers @@ -510,7 +504,10 @@ function init(){ projection: new OpenLayers.Projection('EPSG:4326'), theme:null }; - if (restricted_extent){options['restrictedExtent'] = restricted_extent;} + if (restricted_extent){ + restricted_extent.transform(epsg_display_projection, epsg_projection); + options['restrictedExtent'] = restricted_extent; + } map = new OpenLayers.Map('map', options); permalink = new OpenLayers.Control.Permalink("permalink"); permalink.createParams = createParams; @@ -528,6 +525,7 @@ function init(){ /* if from a permalink */ if (p_zoom) { var p_centerLonLat = new OpenLayers.LonLat(p_lon, p_lat); + p_centerLonLat.transform(epsg_display_projection, epsg_projection); map.setCenter(p_centerLonLat, p_zoom); if (p_display_submited) { document.getElementById('display_submited_check').checked = true; |