MATSIM
WGS84toCH1903LV03.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * WGS84toCH1903LV03.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  double lonNorm = (coord.getX() * 3600 - 26782.5) / 10000;
41  double latNorm = (coord.getY() * 3600 - 169028.66) / 10000;
42 
43  double CH1903X =
44  200147.07 +
45  308807.95 * latNorm +
46  3745.25 * Math.pow(lonNorm, 2) +
47  76.63 * Math.pow(latNorm, 2) -
48  194.56 * Math.pow(lonNorm, 2) * latNorm +
49  119.79 * Math.pow(latNorm, 3);
50 
51  double CH1903Y =
52  600072.37 +
53  211455.93 * lonNorm -
54  10938.51 * lonNorm * latNorm -
55  0.36 * lonNorm * Math.pow(latNorm, 2) -
56  44.54 * Math.pow(lonNorm, 3);
57 
58  /* Important Note: in the Swiss Grid, y describes easting and x describes
59  * northing, contrary to the usual naming conventions! */
60  double elevation;
61  try{
62  elevation = coord.getZ();
63  return new Coord(CH1903Y, CH1903X, elevation);
64  } catch (Exception e){
65  return new Coord(CH1903Y, CH1903X);
66  }
67  }
68 
69 }