forked from malisetti/phpgeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README for new DMS-Formatter
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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]> | ||
|