Skip to content

Commit

Permalink
Updated README for new DMS-Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaschen committed Feb 17, 2013
1 parent edada23 commit cf2af22
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ echo $coordinate1->getDistance($coordinate2, new Haversine()); // returns 128384

### Formatted output of coordinates

You can format a coordinate in different styles. With decimal degrees:

```php
<?php

Expand All @@ -77,6 +79,27 @@ $coordinate = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
echo $coordinate->format(new DecimalDegrees());
```

or with the well known Degrees/Minutes/Seconds (DMS) format:

```php
<?php

use Location\Coordinate;
use Location\Formatter\Coordinate\DMS;

$coordinate = new Coordinate(18.911306, -155.678268); // South Point, HI, USA

$formatter = new DMS();

echo $coordinate->format($formatter); // 18° 54′ 41″ -155° 40′ 42″

$formatter->setSeparator(", ")
->useCardinalLetters(true)
->setUnits(DMS::UNITS_ASCII);

echo $coordinate->format($formatter); // 18° 54' 41" N, 155° 40' 42" W
```

## Credits

* Marcus T. Jaschen <[email protected]>
Expand Down

0 comments on commit cf2af22

Please sign in to comment.