MATSIM
CH1903LV03toWGS84.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * CH1903LV03toWGS84.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.utils.geometry.transformations;
22 
23 import org.matsim.api.core.v01.Coord;
25 
36 
37  @Override
38  public Coord transform(Coord coord) {
39 
40  /* Important Note: in the Swiss Grid, y describes easting and x describes
41  * northing, contrary to the usual naming conventions! */
42  double yNorm = (coord.getX() - 600000.0) / 1000000.0;
43  double xNorm = (coord.getY() - 200000.0) / 1000000.0;
44 
45  double longitude10000Sec =
46  2.6779094 +
47  4.728982 * yNorm +
48  0.791484 * yNorm * xNorm +
49  0.1306 * yNorm * Math.pow(xNorm, 2) -
50  0.0436 * Math.pow(yNorm, 3);
51 
52  double latitude10000Sec =
53  16.9023892 +
54  3.238272 * xNorm -
55  0.270978 * Math.pow(yNorm, 2) -
56  0.002528 * Math.pow(xNorm, 2) -
57  0.0447 * Math.pow(yNorm, 2) * xNorm -
58  0.0140 * Math.pow(xNorm, 3);
59 
60  if (coord.hasZ()) {
61  return new Coord(longitude10000Sec * 100.0 / 36.0, latitude10000Sec * 100.0 / 36.0, coord.getZ());
62  }
63  return new Coord(longitude10000Sec * 100.0 / 36.0, latitude10000Sec * 100.0 / 36.0);
64 
65  }
66 
67 }