| 1 | package Geo::Coordinates::ETRSTM35FIN; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use 5.008006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Math::Trig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # Constants used in calculations transforming between WGS84 and ETRS-TM35FIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | add_constant($self, 'Ca', 6378137.0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | add_constant($self, 'Cb', 6356752.314245); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 4 | add_constant($self, 'Cf', 1.0 / 298.257223563); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | add_constant($self, 'Ck0', 0.9996); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | add_constant($self, 'Clo0', Math::Trig::deg2rad(27.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | add_constant($self, 'CE0', 500000.0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 4 | add_constant($self, 'Cn', get_c($self, 'Cf') / (2.0 - get_c($self, 'Cf'))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | add_constant($self, 'CA1', get_c($self, 'Ca') / (1.0 + get_c($self, 'Cn')) * (1.0 + (get_c($self, 'Cn') ** 2.0) / 4.0 + (get_c($self, 'Cn') ** 4.0) / 64.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 4 | add_constant($self, 'Ce', sqrt(2.0 * get_c($self, 'Cf') - get_c($self, 'Cf') ** 2.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | add_constant($self, 'Ch1', 1.0/2.0 * get_c($self, 'Cn') - 2.0/3.0 * (get_c($self, 'Cn') ** 2.0) + 37.0/96.0 * (get_c($self, 'Cn') ** 3.0) - 1.0/360.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | add_constant($self, 'Ch2', 1.0/48.0 * (get_c($self, 'Cn') ** 2.0) + 1.0/15.0 * (get_c($self, 'Cn') ** 3.0) - 437.0/1440.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | add_constant($self, 'Ch3', 17.0/480.0 * (get_c($self, 'Cn') ** 3.0) - 37.0/840.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | add_constant($self, 'Ch4', 4397.0/161280.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | add_constant($self, 'Ch1p', 1.0/2.0 * get_c($self, 'Cn') - 2.0/3.0 * (get_c($self, 'Cn') ** 2.0) + 5.0/16.0 * (get_c($self, 'Cn') ** 3.0) + 41.0/180.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | add_constant($self, 'Ch2p', 13.0/48.0 * (get_c($self, 'Cn') ** 2.0) - 3.0/5.0 * (get_c($self, 'Cn') ** 3.0) + 557.0/1440.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | add_constant($self, 'Ch3p', 61.0/240.0 * (get_c($self, 'Cn') ** 3.0) - 103.0/140.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | add_constant($self, 'Ch4p', 49561.0/161280.0 * (get_c($self, 'Cn') ** 4.0)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # WGS84 bounds (ref. http://spatialreference.org/ref/epsg/3067/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | add_constant($self, 'WGS84_min_la', "59.3000"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | add_constant($self, 'WGS84_max_la', "70.1300"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | add_constant($self, 'WGS84_min_lo', "19.0900"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | add_constant($self, 'WGS84_max_lo', "31.5900"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # ETRS-TM35FIN bounds (ref. http://spatialreference.org/ref/epsg/3067/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | add_constant($self, 'ETRSTM35FIN_min_x', "6582464.0358"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | add_constant($self, 'ETRSTM35FIN_max_x', "7799839.8902"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | add_constant($self, 'ETRSTM35FIN_min_y', "50199.4814"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | add_constant($self, 'ETRSTM35FIN_max_y', "761274.6247"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 100 | ▶ | sub add_constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_constant: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 100 | my ($class, $constant_name, $constant_value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 100 | $class->{$constant_name} = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 100 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 512 | ▶ | sub get_constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_constant: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 512 | my ($class, $constant_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 512 | return $class->{$constant_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Alias for get_constant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 512 | ▶ | sub get_c { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_c: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 512 | my ($class, $constant_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 512 | return get_constant($class, $constant_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 22 | ▶ | sub is_defined_ETRSTM35FINxy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_defined_ETRSTM35FINxy: called CC=6 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 22 | my @params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 22 | my ($class, $etrs_x, $etrs_y) = @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 22 | ▶ | if (scalar(@params) != 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | croak 'Geo::Coordinates::ETRSTM35FIN::is_defined_ETRSTM35FINxy needs two arguments'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 22 | ▶ | if (($etrs_x >= get_c($class, 'ETRSTM35FIN_min_x')) and ($etrs_x <= get_c($class, 'ETRSTM35FIN_max_x')) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$etrs_x >= get_c($class, "ETRSTM35FIN_min_x") and $etrs_x <= get_c($class, "ETRSTM35FIN_max_x") and $etrs_y >= get_c($class, "ETRSTM35FIN_min_y") and $etrs_y <= get_c($class, "ETRSTM35FIN_max_y")
$etrs_x >= get_c($class, "ETRSTM35FIN_min_x") and $etrs_x <= get_c($class, "ETRSTM35FIN_max_x") and $etrs_y >= get_c($class, "ETRSTM35FIN_min_y")
$etrs_x >= get_c($class, "ETRSTM35FIN_min_x") and $etrs_x <= get_c($class, "ETRSTM35FIN_max_x")
MC/DC50%2/4
$etrs_x >= get_c($class, "ETRSTM35FIN_min_x") and $etrs_x <= get_c($class, "ETRSTM35FIN_max_x") and $etrs_y >= get_c($class, "ETRSTM35FIN_min_y") and $etrs_y <= get_c($class, "ETRSTM35FIN_max_y")
$etrs_x >= get_c($class, "ETRSTM35FIN_min_x")
$etrs_x <= get_c($class, "ETRSTM35FIN_max_x")
$etrs_y >= get_c($class, "ETRSTM35FIN_min_y")
$etrs_y <= get_c($class, "ETRSTM35FIN_max_y")
Truth table60%3/5
A and B and C and D
A= $etrs_x >= get_c($class, "ETRSTM35FIN_min_x")B= $etrs_x <= get_c($class, "ETRSTM35FIN_max_x")C= $etrs_y >= get_c($class, "ETRSTM35FIN_min_y")D= $etrs_y <= get_c($class, "ETRSTM35FIN_max_y")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ($etrs_y >= get_c($class, 'ETRSTM35FIN_min_y')) and ($etrs_y <= get_c($class, 'ETRSTM35FIN_max_y'))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Is in bounds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 14 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 22 | ▶ | sub is_defined_WGS84lalo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_defined_WGS84lalo: called CC=6 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 22 | my @params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 22 | my ($class, $wgs_la, $wgs_lo) = @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 22 | ▶ | if (scalar(@params) != 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | croak 'Geo::Coordinates::ETRSTM35FIN::is_defined_WGS84lalo needs two arguments'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 22 | ▶ | if (($wgs_la >= get_c($class, 'WGS84_min_la')) and ($wgs_la <= get_c($class, 'WGS84_max_la')) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$wgs_la >= get_c($class, "WGS84_min_la") and $wgs_la <= get_c($class, "WGS84_max_la") and $wgs_lo >= get_c($class, "WGS84_min_lo") and $wgs_lo <= get_c($class, "WGS84_max_lo")
$wgs_la >= get_c($class, "WGS84_min_la") and $wgs_la <= get_c($class, "WGS84_max_la") and $wgs_lo >= get_c($class, "WGS84_min_lo")
$wgs_la >= get_c($class, "WGS84_min_la") and $wgs_la <= get_c($class, "WGS84_max_la")
MC/DC50%2/4
$wgs_la >= get_c($class, "WGS84_min_la") and $wgs_la <= get_c($class, "WGS84_max_la") and $wgs_lo >= get_c($class, "WGS84_min_lo") and $wgs_lo <= get_c($class, "WGS84_max_lo")
$wgs_la >= get_c($class, "WGS84_min_la")
$wgs_la <= get_c($class, "WGS84_max_la")
$wgs_lo >= get_c($class, "WGS84_min_lo")
$wgs_lo <= get_c($class, "WGS84_max_lo")
Truth table60%3/5
A and B and C and D
A= $wgs_la >= get_c($class, "WGS84_min_la")B= $wgs_la <= get_c($class, "WGS84_max_la")C= $wgs_lo >= get_c($class, "WGS84_min_lo")D= $wgs_lo <= get_c($class, "WGS84_max_lo")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ($wgs_lo >= get_c($class, 'WGS84_min_lo')) and ($wgs_lo <= get_c($class, 'WGS84_max_lo'))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Is in bounds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 14 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 14 | ▶ | sub ETRSTM35FINxy_to_WGS84lalo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ETRSTM35FINxy_to_WGS84lalo: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 14 | my @params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 14 | my ($class, $etrs_x, $etrs_y) = @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 14 | ▶ | if (scalar(@params) != 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | croak 'Geo::Coordinates::ETRSTM35FIN::ETRSTM35FINxy_to_WGS84lalo needs two arguments' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 11 | ▶ | if (!is_defined_ETRSTM35FINxy($class,$etrs_x, $etrs_y)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | return (undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 7 | my $E = $etrs_x / (get_c($class,'CA1') * get_c($class,'Ck0')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 7 | my $nn = ($etrs_y - get_c($class,'CE0')) / (get_c($class,'CA1') * get_c($class,'Ck0')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 7 | my $E1p = get_c($class,'Ch1') * sin(2.0 * $E) * Math::Trig::cosh(2.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 7 | my $E2p = get_c($class,'Ch2') * sin(4.0 * $E) * Math::Trig::cosh(4.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 7 | my $E3p = get_c($class,'Ch3') * sin(6.0 * $E) * Math::Trig::cosh(6.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 7 | my $E4p = get_c($class,'Ch4') * sin(8.0 * $E) * Math::Trig::cosh(8.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 7 | my $nn1p = get_c($class,'Ch1') * cos(2.0 * $E) * Math::Trig::sinh(2.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 7 | my $nn2p = get_c($class,'Ch2') * cos(4.0 * $E) * Math::Trig::sinh(4.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 7 | my $nn3p = get_c($class,'Ch3') * cos(6.0 * $E) * Math::Trig::sinh(6.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 7 | my $nn4p = get_c($class,'Ch4') * cos(8.0 * $E) * Math::Trig::sinh(8.0 * $nn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 7 | my $Ep = $E - $E1p - $E2p - $E3p - $E4p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 7 | my $nnp = $nn - $nn1p - $nn2p - $nn3p - $nn4p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 7 | my $be = Math::Trig::asin(sin($Ep) / Math::Trig::cosh($nnp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 7 | my $Q = Math::Trig::asinh(Math::Trig::tan($be)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 7 | my $Qp = $Q + get_c($class,'Ce') * Math::Trig::atanh(get_c($class,'Ce') * Math::Trig::tanh($Q)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 7 | $Qp = $Q + get_c($class,'Ce') * Math::Trig::atanh(get_c($class,'Ce') * Math::Trig::tanh($Qp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 7 | $Qp = $Q + get_c($class,'Ce') * Math::Trig::atanh(get_c($class,'Ce') * Math::Trig::tanh($Qp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 7 | $Qp = $Q + get_c($class,'Ce') * Math::Trig::atanh(get_c($class,'Ce') * Math::Trig::tanh($Qp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my $wgs_la = Math::Trig::rad2deg(Math::Trig::atan(Math::Trig::sinh($Qp))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 7 | my $wgs_lo = Math::Trig::rad2deg(get_c($class,'Clo0') + Math::Trig::asin(Math::Trig::tanh($nnp) / cos($be))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 7 | return ($wgs_la, $wgs_lo); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 14 | ▶ | sub WGS84lalo_to_ETRSTM35FINxy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
WGS84lalo_to_ETRSTM35FINxy: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 14 | my @params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 14 | my ($class, $wgs_la, $wgs_lo) = @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 14 | ▶ | if (scalar(@params) != 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 3 | croak 'Geo::Coordinates::ETRSTM35FIN::WGS84lalo_to_ETRSTM35FINxy needs two arguments' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 11 | ▶ | if (!is_defined_WGS84lalo($class, $wgs_la, $wgs_lo)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | return (undef, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 7 | my $la = Math::Trig::deg2rad($wgs_la); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 7 | my $lo = Math::Trig::deg2rad($wgs_lo); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 7 | my $Q = Math::Trig::asinh(Math::Trig::tan($la)) - get_c($class,'Ce') * Math::Trig::atanh(get_c($class,'Ce') * sin($la)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 7 | my $be = Math::Trig::atan(Math::Trig::sinh($Q)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 7 | my $nnp = Math::Trig::atanh(cos($be) * sin($lo - get_c($class,'Clo0'))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 7 | my $Ep = Math::Trig::asin(sin($be) * Math::Trig::cosh($nnp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 7 | my $E1 = get_c($class,'Ch1p') * sin(2.0 * $Ep) * Math::Trig::cosh(2.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 7 | my $E2 = get_c($class,'Ch2p') * sin(4.0 * $Ep) * Math::Trig::cosh(4.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 7 | my $E3 = get_c($class,'Ch3p') * sin(6.0 * $Ep) * Math::Trig::cosh(6.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 7 | my $E4 = get_c($class,'Ch4p') * sin(8.0 * $Ep) * Math::Trig::cosh(8.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 7 | my $nn1 = get_c($class,'Ch1p') * cos(2.0 * $Ep) * Math::Trig::sinh(2.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 7 | my $nn2 = get_c($class,'Ch2p') * cos(4.0 * $Ep) * Math::Trig::sinh(4.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 7 | my $nn3 = get_c($class,'Ch3p') * cos(6.0 * $Ep) * Math::Trig::sinh(6.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 7 | my $nn4 = get_c($class,'Ch4p') * cos(8.0 * $Ep) * Math::Trig::sinh(8.0 * $nnp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | my $E = $Ep + $E1 + $E2 + $E3 + $E4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 7 | my $nn = $nnp + $nn1 + $nn2 + $nn3 + $nn4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 7 | my $etrs_x = get_c($class,'CA1') * $E * get_c($class,'Ck0'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 7 | my $etrs_y = get_c($class,'CA1') * $nn * get_c($class,'Ck0') + get_c($class,'CE0'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 7 | return ($etrs_x, $etrs_y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||