Module: Swissgrid::WGS84

Defined in:
lib/swissgrid/wgs84.rb

Constant Summary collapse

Y_BERN =

Projection centre Bern

600_000
X_BERN =

in meters

200_000
SCALE =

in meters

1_000_000

Class Method Summary collapse

Class Method Details

.from_ch1903(a_point) ⇒ List

Converts a WGS84 point to a CH1903 point.

Parameters:

  • a_point (List)

    the WGS84 point to be converted.

Returns:

  • (List)

    the converted WGS84 point as CH1903 point.



16
17
18
19
20
21
22
23
# File 'lib/swissgrid/wgs84.rb', line 16

def self.from_ch1903(a_point)
  y, x , z = a_point
  y_prime = (y - Y_BERN) / SCALE.to_f
  x_prime = (x - X_BERN) / SCALE.to_f

  # compute CH1903 point
  convert(y_prime, x_prime, z)
end