PHP code example of antistatique / swisstopo
1. Go to this page and download the library: Download antistatique/swisstopo library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
antistatique / swisstopo example snippets
$swiss_converter = new Antistatique\Swisstopo\SwisstopoConverter();
$coordinates = $swiss_converter->fromWGSToMN03(46.462057617639, 6.8486736590762);
// Coordinates -> ['x' => 145807.4339423232, 'y' => 554679.5530031546].
$swiss_converter = new Antistatique\Swisstopo\SwisstopoConverter();
$coordinates = $swiss_converter->fromMN03ToWGS(554680, 145807);
// Coordinates -> ['lat' => 46.462057617639346, 'long' => 6.848673659076181].
$swiss_converter = new Antistatique\Swisstopo\SwisstopoConverter();
$coordinates = $swiss_converter->fromWGSToMN95(46.46312579498212, 6.8534397262208095);
// Coordinates -> ['east' => 2555046.5560538797, 'north' => 1145923.4267763223].
$swiss_converter = new Antistatique\Swisstopo\SwisstopoConverter();
$coordinates = $swiss_converter->fromMN95ToWGS(2555047, 1145923);
// Coordinates -> ['lat' => 46.46312579498212,'long' => 6.8534397262208095]