The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Geo::Coordinates::Converter::LV03 - Convert Swiss LV03 coordinates to WSG84 and vice versa

VERSION

Version 0.03

SYNOPSIS

    use Geo::Coordinates::Converter::LV03;

    my ($x, $y) = Geo::Coordinates::Converter::LV03::lat_lng_2_y_x($φ, $λ);
    my ($φ, $λ) = Geo::Coordinates::Converter::LV03::y_x_2_lat_lng($x, $y);
   

EXPORT

On request, lat_lng_2_y_x and y_x_2_lat_lng are exported:

    use Geo::Coordinates::Converter::LV03 qw(lat_lng_2_y_x y_x_2_lat_lng);

    my ($x, $y) = lat_lng_2_y_x($φ, $λ);
    my ($φ, $λ) = y_x_2_lat_lng($x, $y);

SUBROUTINES/METHODS

lat_lng_2_y_x($lat, $lng)

Convert a latitude/longitude tuple to a Swiss LV03 datum.

Note: the Swiss seem to name the east-west axis by Y and the the north-south axis by X. Hence the strangly order of y and x in the sub's name.

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 Y and the the north-south axis by X. Hence, the first argument is named y, the second x.

WARNING

The document from which I derived the formulas (see LINKS) contains this friendly warning; »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).

WHY

Why was I not using the already existing 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.

AUTHOR

René Nyffenegger, <rene.nyffenegger at adp-gmbh.ch>

SEE ALSO

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

https://asciich.ch/wordpress/koordinatenumrechner-schweiz-international/: A converter in javascript.

Fabien Fivaz's wgs84_to_lv03.pl. Apparently, his script uses the online service at http://geodesy.geo.admin.ch/reframe/ to convert the coordinates.

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 X then y. More gravely is the fact, that the x in "lat_lng_2_y_x" and in "y_x_2_lat_lng" is what usually is the 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 bug-geo-coordinates-converter-lv03 at rt.cpan.org, or through the web interface at 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.

SOURCE CODE

The source code is in a github repository. Meaningful pull requests are welcome.

LICENSE AND COPYRIGHT

Copyright 2017 René Nyffenegger.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.