Difference between revisions of "Template:Decdeg/doc"
imported>Lam-ang m (categorise the template page instead of the doc page) |
imported>Trialpears m (Removing unnecessary Template:Intricate template per Template talk:Intricate template#Change to editnotice? (via WP:JWB)) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | ||
__NOTOC__ | __NOTOC__ | ||
| − | |||
This [[Help:Templates/Helper templates|helper template]] provides a way to convert [[Geographic coordinate system|geographic coordinates]] from degree, minute, second format to [[decimal degrees]]. It is intended for use in building infobox templates. | This [[Help:Templates/Helper templates|helper template]] provides a way to convert [[Geographic coordinate system|geographic coordinates]] from degree, minute, second format to [[decimal degrees]]. It is intended for use in building infobox templates. | ||
| Line 33: | Line 32: | ||
Input degrees can be signed in which case the hemisphere is not required. A negative value implies a value in the western or southern hemisphere. Minutes and seconds need not be specified. If no degrees are specified then a value of zero is assumed. This template does not attempt to trap invalid values and results in this case might be undefined. | Input degrees can be signed in which case the hemisphere is not required. A negative value implies a value in the western or southern hemisphere. Minutes and seconds need not be specified. If no degrees are specified then a value of zero is assumed. This template does not attempt to trap invalid values and results in this case might be undefined. | ||
| − | The decimal precision of the result is determined by the value assigned < | + | The decimal precision of the result is determined by the value assigned <kbd>rnd</kbd>, which defaults to 7. |
Currently this template does not attempt to trap invalid values. | Currently this template does not attempt to trap invalid values. | ||
| Line 39: | Line 38: | ||
=== Examples === | === Examples === | ||
| − | :< | + | :<kbd><nowiki>{{decdeg|deg=37|min=51|sec=00|hem=N}}</nowiki></kbd> → {{decdeg|deg=37|min=51|sec=00|hem=N}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|deg=119|min=34|sec=04|hem=W}}</nowiki></kbd> → {{decdeg|deg=119|min=34|sec=04|hem=W}} |
When using unnamed parameters, the hemisphere must be the fourth parameter: | When using unnamed parameters, the hemisphere must be the fourth parameter: | ||
| − | :< | + | :<kbd><nowiki>{{decdeg|37|51||N}}</nowiki></kbd> → {{decdeg|37|51||N}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|119|34||W}}</nowiki></kbd> → {{decdeg|119|34||W}} |
Input can be signed or unsigned decimal degrees: | Input can be signed or unsigned decimal degrees: | ||
| − | :< | + | :<kbd><nowiki>{{decdeg|37.85|||N}}</nowiki></kbd> → {{decdeg|37.85|||N}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|119.5666667|||W}}</nowiki></kbd> → {{decdeg|119.5666667|||W}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|37.85}}</nowiki></kbd> → {{decdeg|37.85}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|-119.5666667}}</nowiki></kbd> → {{decdeg|-119.5666667}} |
When using rounding, the factor must be the fifth parameter: | When using rounding, the factor must be the fifth parameter: | ||
| − | :< | + | :<kbd><nowiki>{{decdeg|37.85||||1}}</nowiki></kbd> → {{decdeg|37.85||||1}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|-119.5666667||||1}}</nowiki></kbd> → {{decdeg|-119.5666667||||1}} |
If a value is undefined then zero is assumed: | If a value is undefined then zero is assumed: | ||
| − | :< | + | :<kbd><nowiki>{{decdeg||51||N}}</nowiki></kbd> → {{decdeg||51||N}} |
| − | :< | + | :<kbd><nowiki>{{decdeg||34||W}}</nowiki></kbd> → {{decdeg||34||W}} |
Negative zero values are accommodated: | Negative zero values are accommodated: | ||
| − | :< | + | :<kbd><nowiki>{{decdeg|0|51}}</nowiki></kbd> → {{decdeg||51||N}} |
| − | :< | + | :<kbd><nowiki>{{decdeg|-0|34}}</nowiki></kbd> → {{decdeg|-0|34}} |
=== See also === | === See also === | ||
| Line 74: | Line 73: | ||
{{Math templates|conversion}} | {{Math templates|conversion}} | ||
| − | <includeonly>{{ | + | <includeonly>{{Sandbox other|| |
[[Category:Numerical conversion templates]] | [[Category:Numerical conversion templates]] | ||
[[Category:Coordinates templates]] | [[Category:Coordinates templates]] | ||
[[Category:Convert-like templates|{{SUBPAGENAME}}]] | [[Category:Convert-like templates|{{SUBPAGENAME}}]] | ||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 22:23, 9 July 2020
| This is a documentation subpage for Template:Decdeg. It contains usage information, categories and other content that is not part of the original template page. |
This helper template provides a way to convert geographic coordinates from degree, minute, second format to decimal degrees. It is intended for use in building infobox templates.
Usage
The template can be used with named or unnamed parameters as shown.
| Parameter | Description |
|---|---|
{{decdeg
| deg =
| min =
| sec =
| hem =
| rnd =
}}
|
Degrees Minutes Seconds Hemisphere Round |
Input degrees can be signed in which case the hemisphere is not required. A negative value implies a value in the western or southern hemisphere. Minutes and seconds need not be specified. If no degrees are specified then a value of zero is assumed. This template does not attempt to trap invalid values and results in this case might be undefined.
The decimal precision of the result is determined by the value assigned rnd, which defaults to 7.
Currently this template does not attempt to trap invalid values.
Examples
- {{decdeg|deg=37|min=51|sec=00|hem=N}} → 37.85
- {{decdeg|deg=119|min=34|sec=04|hem=W}} → -119.5677778
When using unnamed parameters, the hemisphere must be the fourth parameter:
- {{decdeg|37|51||N}} → 37.85
- {{decdeg|119|34||W}} → -119.5666667
Input can be signed or unsigned decimal degrees:
- {{decdeg|37.85|||N}} → 37.85
- {{decdeg|119.5666667|||W}} → -119.5666667
- {{decdeg|37.85}} → 37.85
- {{decdeg|-119.5666667}} → -119.5666667
When using rounding, the factor must be the fifth parameter:
- {{decdeg|37.85||||1}} → 37.9
- {{decdeg|-119.5666667||||1}} → -119.6
If a value is undefined then zero is assumed:
- {{decdeg||51||N}} → 0.85
- {{decdeg||34||W}} → -0.5666667
Negative zero values are accommodated:
- {{decdeg|0|51}} → 0.85
- {{decdeg|-0|34}} → -0.5666667
See also