Skip to content

Instantly share code, notes, and snippets.

@will83
Last active May 13, 2025 07:50
Show Gist options
  • Select an option

  • Save will83/5920606 to your computer and use it in GitHub Desktop.

Select an option

Save will83/5920606 to your computer and use it in GitHub Desktop.

Revisions

  1. will83 revised this gist Jan 31, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ function lambert93ToWgs84($x, $y){
    $delx = $x - $b14;
    $dely = $y - $b15;
    $gamma = atan( -($delx) / $dely );
    $r = sqrt(($delx*$delx))+(($dely*$dely));
    $r = sqrt(($delx*$delx)+($dely*$dely));
    $latiso = log($b17/$r)/$b16;
    $sinphiit0 = tanh($latiso+$b10*atanh($b10*sin(1)));
    $sinphiit1 = tanh($latiso+$b10*atanh($b10*$sinphiit0));
  2. will83 revised this gist Jan 31, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ function lambert93ToWgs84($x, $y){
    $delx = $x - $b14;
    $dely = $y - $b15;
    $gamma = atan( -($delx) / $dely );
    $r = sqrt((carre($delx))+(carre($dely)));
    $r = sqrt(($delx*$delx))+(($dely*$dely));
    $latiso = log($b17/$r)/$b16;
    $sinphiit0 = tanh($latiso+$b10*atanh($b10*sin(1)));
    $sinphiit1 = tanh($latiso+$b10*atanh($b10*$sinphiit0));
  3. will83 revised this gist Jul 3, 2013. No changes.
  4. will83 revised this gist Jul 3, 2013. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,6 @@ function lambert93ToWgs84($x, $y){
    $latrad = asin($sinphiit6);
    $long = ($longrad/pi()*180);
    $lat = ($latrad/pi()*180);
    print_r($x);

    return array(
    'lambert93' => array(
  5. will83 revised this gist Jul 3, 2013. 1 changed file with 23 additions and 1 deletion.
    24 changes: 23 additions & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -40,4 +40,26 @@ function lambert93ToWgs84($x, $y){
    'long' => $long
    )
    );
    }
    }

    // Exemple d'utilisation :
    $x = 955502.7409000024;
    $y = 6225307.0799999982;
    print_r(lambert93ToWgs84($x,$y));

    /* Résultat en sortie :
    Array
    (
    [lambert93] => Array
    (
    [x] => 955502.7409000024
    [y] => 6225307.0799999982
    )
    [wgs84] => Array
    (
    [lat] => 43.081387131355
    [long] => 6.1358573938246
    )
    )
    */
  6. will83 revised this gist Jul 3, 2013. No changes.
  7. will83 revised this gist Jul 3, 2013. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,17 @@
    <?php
    function lambert93ToWgs84($x, $y){

    $x = number_format($x, 10, '.', '');
    $y = number_format($y, 10, '.', '');

    $b6 = 6378137.0000;
    $b7 = 298.257222101;
    $b8 = 1/$b7;
    $b9 = 2*$b8-$b8*$b8;
    $b10 = sqrt($b9);

    $b13 = 3.000000000;
    $b14 = 700000.0000;
    $b15 = 12655612.0499;
    $b16 = 0.7256077650532670;
    $b17 = 11754255.426096;

    $delx = $x - $b14;
    $dely = $y - $b15;
    $gamma = atan( -($delx) / $dely );
    @@ -43,5 +40,4 @@ function lambert93ToWgs84($x, $y){
    'long' => $long
    )
    );

    }
  8. will83 created this gist Jul 3, 2013.
    47 changes: 47 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    function lambert93ToWgs84($x, $y){

    $x = number_format($x, 10, '.', '');
    $y = number_format($y, 10, '.', '');

    $b6 = 6378137.0000;
    $b7 = 298.257222101;
    $b8 = 1/$b7;
    $b9 = 2*$b8-$b8*$b8;
    $b10 = sqrt($b9);

    $b13 = 3.000000000;
    $b14 = 700000.0000;
    $b15 = 12655612.0499;
    $b16 = 0.7256077650532670;
    $b17 = 11754255.426096;

    $delx = $x - $b14;
    $dely = $y - $b15;
    $gamma = atan( -($delx) / $dely );
    $r = sqrt((carre($delx))+(carre($dely)));
    $latiso = log($b17/$r)/$b16;
    $sinphiit0 = tanh($latiso+$b10*atanh($b10*sin(1)));
    $sinphiit1 = tanh($latiso+$b10*atanh($b10*$sinphiit0));
    $sinphiit2 = tanh($latiso+$b10*atanh($b10*$sinphiit1));
    $sinphiit3 = tanh($latiso+$b10*atanh($b10*$sinphiit2));
    $sinphiit4 = tanh($latiso+$b10*atanh($b10*$sinphiit3));
    $sinphiit5 = tanh($latiso+$b10*atanh($b10*$sinphiit4));
    $sinphiit6 = tanh($latiso+$b10*atanh($b10*$sinphiit5));
    $longrad = $gamma/$b16+$b13/180*pi();
    $latrad = asin($sinphiit6);
    $long = ($longrad/pi()*180);
    $lat = ($latrad/pi()*180);
    print_r($x);

    return array(
    'lambert93' => array(
    'x' => $x,
    'y' => $y
    ),
    'wgs84' => array(
    'lat' => $lat,
    'long' => $long
    )
    );

    }