Navigation Menu

Skip to content

A port of gausskruger.js to PHP, packaged as a class ready to use as an extension in Yii framework, but can easily be used elsewhere too. Converts between RT90 and WGS84 as well as between SWEREF99 and WGS84.

License

TillgangligtNu/EGaussKruger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

EGaussKruger

This is a port of gausskruger.js to PHP packaged as a Yii extension. (but can easily be used for other PHP projects too)

gausskruger.js is a library to convert to/from common Swedish coordinate systems and the international WGS84 standard used by most GPS devices today. It can convert RT90 <-> WGS84 and SWEREF99 <-> WGS84.

The port is more or less just a translation from JavaScript to PHP with the code encapsulated inside a class. (the original library uses global variables, which is not the case here)

#Original JS version Many thanks goes to the original JavaScript version that can be found here: http://mellifica.se/geodesi/gausskruger.js

#Usage To convert from WGS84 to RT90 (2.5 gon west)

$gk = new EGaussKruger();
$gk->swedish_params("rt90_2.5_gon_v");
list($rt90_x, $rt90_y) = $gk->geodetic_to_grid($latitude, $longitude);

To convert from RT90 (2.5 gon west) to WGS84

$gk = new EGaussKruger();
$gk->swedish_params("rt90_2.5_gon_v");
list($latitude, $longitude) = $gk->grid_to_geodetic($rt90_x, $rt90_5);

If you open the EGaussKruger.php file and read the code for swedish_params you will see the exact name of each variant of RT90 and SWEREF99 that is supported.

#Use as Yii Extension Just copy it to protected/extensions/ and make sure you autoload the protected/extensions/ directory.

#Use elsewhere You can rename the class if you want to use it elsewhere where the E prefix is not wanted for extensions. It doesn't actually depend on anything in the Yii framework.

About

A port of gausskruger.js to PHP, packaged as a class ready to use as an extension in Yii framework, but can easily be used elsewhere too. Converts between RT90 and WGS84 as well as between SWEREF99 and WGS84.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages