/**
  * Create a SWEREF99 position by converting a WGS84 position.
  *
  * @param position WGS84 position to convert
  * @param projection Projection to convert to
  */
 private function SWEREF99PositionPositionProjection(WGS84Position $position, $projection)
 {
     parent::__construct(Grid::SWEREF99);
     $gkProjection = new GaussKreugerProjection();
     $gkProjection->swedish_params($this->getProjectionString($projection));
     list($this->latitude, $this->longitude) = $gkProjection->geodetic_to_grid($position->getLatitude(), $position->getLongitude());
     $this->projection = $projection;
 }
 public function testWGS84Parse()
 {
     // Values from Eniro.se
     $wgsPosDM = null;
     $wgsPosDMs = null;
     try {
         $wgsPosDM = new WGS84Position("N 62º 10.560' E 015º 54.180'", WGS84Format::DEGREES_MINUTES);
         $wgsPosDMs = new WGS84Position("N 62º 10' 33.60\" E 015º 54' 10.80\"", WGS84Format::DEGREES_MINUTES_SECONDS);
     } catch (ParseException $e) {
         $this->fail($e->getMessage());
     }
     $lat = (double) round($wgsPosDM->getLatitude() * 1000) / 1000;
     $lon = (double) round($wgsPosDM->getLongitude() * 1000) / 1000;
     $this->assertEquals(62.176, $lat);
     $this->assertEquals(15.903, $lon);
     $lat_s = (double) round($wgsPosDMs->getLatitude() * 1000) / 1000;
     $lon_s = (double) round($wgsPosDMs->getLongitude() * 1000) / 1000;
     $this->assertEquals(62.176, $lat_s);
     $this->assertEquals(15.903, $lon_s);
 }