Geo-Coordinates-Converter-LV03
view release on metacpan or search on metacpan
lib/Geo/Coordinates/Converter/LV03.pm view on Meta::CPAN
76.63 * $Ï2 -
194.56 * $λ2 * $Ï_ +
119.79 * $Ï3;
return ($y, $x);
} #_}
sub y_x_2_lat_lng { #_{
=head2 y_x_2_lat_lng($y, $x)
Convert a Swiss LV03 datum to a latitude and longitude tuple.
Note: the Swiss seem to name the east-west axis by B<Y> and the
the north-south axis by B<X>. Hence, the first argument is named C<y>, the second C<x>.
=cut
my $y = shift; # Rechtswert
my $x = shift; # Hochwert
# Die Projektionskoordinaten y und x sind ins zivile System (Bern = 0 / 0) und in die Einheit [1000 km] umzuwandeln:
my $y_ = ($y - 600_000) / 1_000_000;
my $x_ = ($x - 200_000) / 1_000_000;
# Lange und Breite in der Einheit [10000"] berechnen:
my $y2 = $y_*$y_;
my $y3 = $y2*$y_;
my $x2 = $x_*$x_;
my $x3 = $x2*$x_;
my $λ_ = 2.677_9094 +
4.728_982 * $y_ +
0.791_484 * $y_ * $x_ +
0.130_6 * $y_ * $x2 -
0.043_6 * $y3;
my $Ï_ = 16.902_3892 +
3.238_272 * $x_ -
0.270_978 * $y2 -
0.002_528 * $x2 -
0.044_7 * $y2 * $x_ -
0.014_0 * $x3;
# Umrechnen in ° Einheit
my $Ï = $Ï_ * 100 / 36;
my $λ = $λ_ * 100 / 36;
return ($Ï, $λ);
} #_}
#_}
#_{ Warning
=head1 WARNING
The document from which I derived the formulas (see LINKS) contains
this friendly warning; »I<Diese Formeln haben eine reduzierte Genauigkeit und sind
vor allem für Navigationszwecke vorgesehen. Sie dürfen nicht für die amtliche Vermessung oder für geodätische Anwendungen verwendet werden!>« (that is: only to be used for navigational purposes,
not of exact (or even official) measurements or geodatic applications).
=cut
#_}
#_{ Why
=head1 WHY
Why was I not using the already existing L<Geo::Coordinates::Converter|https://metacpan.org/pod/Geo::Coordinates::Converter>?
I tried, but that module's code seemed too hard and esoteric to extend. So I made this module a seperate one.
=cut
#_}
#_{ Author
=head1 AUTHOR
René Nyffenegger, C<< <rene.nyffenegger at adp-gmbh.ch> >>
=cut
#_}
#_{ See also
=head1 SEE ALSO
L<https://www.swisstopo.admin.ch/content/swisstopo-internet/de/online/calculation-services/_jcr_content/contentPar/tabs/items/dokumente_und_publik/tabPar/downloadlist/downloadItems/7_1467103072612.download/ch1903wgs84de.pdf>
L<< https://asciich.ch/wordpress/koordinatenumrechner-schweiz-international/ >>: A converter in javascript.
Fabien Fivaz's L<< wgs84_to_lv03.pl|https://github.com/ffivaz/wgs84_to_lv03 >>. Apparently, his script uses the online service at
L<< http://geodesy.geo.admin.ch/reframe/ >> to convert the coordinates.
=cut
#_}
#_{ Bugs and caveats
=head1 BUGS AND CAVEATS
The common order of using lattitude and longitude is first: lattitude, the longitude. lattitude goes in y-direction, longitude in x-direction. So,
they're in a different order than the usually known C<X> then C<y>. More gravely is the fact, that the C<x> in L</lat_lng_2_y_x> and in
L</y_x_2_lat_lng> is what usually is the C<y>, and vice versa. I should and might change that once. Then again, I might not find the time.
Please report any bugs or feature requests to C<bug-geo-coordinates-converter-lv03 at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Coordinates-Converter-LV03>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=cut
#_}
#_{ Source code
=head1 SOURCE CODE
The source code is in a L<github repository|https://github.com/ReneNyffenegger/Geo-Coordinates-Converter-LV03>. Meaningful pull requests are welcome.
=cut
#_}
#_{ License and Copyright
=head1 LICENSE AND COPYRIGHT
Copyright 2017 René Nyffenegger.
This program is free software; you can redistribute it and/or modify it
( run in 1.324 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )