aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/OpenLayers.Projection.CH1903.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/OpenLayers.Projection.CH1903.js')
-rw-r--r--web/js/OpenLayers.Projection.CH1903.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/web/js/OpenLayers.Projection.CH1903.js b/web/js/OpenLayers.Projection.CH1903.js
index f050441e6..cb62a0168 100644
--- a/web/js/OpenLayers.Projection.CH1903.js
+++ b/web/js/OpenLayers.Projection.CH1903.js
@@ -148,18 +148,20 @@ OpenLayers.Projection.CH1903 = {
// Function to convert a WGS84 coordinate to a Swiss coordinate.
projectForwardSwiss: function(point) {
- var newPoint = {};
- newPoint.x = OpenLayers.Projection.CH1903.WGStoCHx(point.x, point.y);
- newPoint.y = OpenLayers.Projection.CH1903.WGStoCHy(point.x, point.y);
- return newPoint;
+ var x = OpenLayers.Projection.CH1903.WGStoCHx(point.y, point.x),
+ y = OpenLayers.Projection.CH1903.WGStoCHy(point.y, point.x);
+ point.x = y; // x/y are geometrically swapped by the conversion functions
+ point.y = x;
+ return point;
},
// Function to convert a Swiss coordinate to a WGS84 coordinate.
projectInverseSwiss: function(point) {
- var newPoint = {};
- newPoint.x = OpenLayers.Projection.CH1903.chToWGSlng(point.y, point.x);
- newPoint.y = OpenLayers.Projection.CH1903.chToWGSlat(point.y, point.x);
- return newPoint;
+ var lon = OpenLayers.Projection.CH1903.chToWGSlng(point.x, point.y);
+ var lat = OpenLayers.Projection.CH1903.chToWGSlat(point.x, point.y);
+ point.x = lon;
+ point.y = lat;
+ return point;
}
};
@@ -170,4 +172,4 @@ OpenLayers.Projection.CH1903 = {
OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:21781",
OpenLayers.Projection.CH1903.projectForwardSwiss);
OpenLayers.Projection.addTransform("EPSG:21781", "EPSG:4326",
- OpenLayers.Projection.CH1903.projectInverseSwiss); \ No newline at end of file
+ OpenLayers.Projection.CH1903.projectInverseSwiss);