Predložak:Decdeg: razlika između inačica

Izvor: Hrvatska internetska enciklopedija
Prijeđi na navigaciju Prijeđi na pretraživanje
Bot: Automatski unos stranica
 
m bnz
 
Redak 1: Redak 1:
<!--'''Predložak:Decdeg'''--><includeonly>{{#expr: (
<includeonly>{{#expr: (
   {{#switch: {{{hem|{{{4|}}}}}}
   {{#switch: {{{hem|{{{4|}}}}}}
     | W|w|S|s = -1
     | W|w|S|s = -1

Posljednja izmjena od 2. travanj 2022. u 14:35


{{#ifexist:Predložak:Decdeg/doc| {{#switch: eng alb = boš = cg = češ = eng = fra = tal = mađ = nje = por = rus = srp = špa = šve = slo =

}}{{#invoke:Category handler|main|draft={{SAFESUBST:#invoke:Unsubst||$B=

{{#invoke:Category handler|main}}

}}}} {{#ifeq:decdeg |doc

{{#ifeq:show |show

{{#invoke:Category handler|main|draft={{SAFESUBST:#invoke:Unsubst||$B= {{#invoke:Category handler|main}}

}}}}

        }}{{#if: |
{{#ifexist:Predložak:Decdeg main}}
                 }}
        }}
   }}
Upozorenje Ovaj predložak koristi jedan ili više parametara koje nije nužno navesti: vidi stranicu za razgovor za detalje.

Sintaksa ovog predloška je kompleksna. Molimo nemojte ga mijenjati ukoliko niste sigurni da razumijete njegovu konstrukciju i ako niste spremni popraviti sve posljedice usputne štete, u slučaju neočekivanih rezultata. Svi eksperimenti trebali bi biti na Stranici za vježbanje ili u vašem suradničkom prostoru.

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[uredi]

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[uredi]

{{decdeg|deg=37|min=51|sec=00|hem=N}} → {{#expr: (
 {{#switch: N
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:37|abs37|0}}
 +
 {{#if:51|abs51/60|0}}
 +
 {{#if:00|abs00/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|deg=119|min=34|sec=04|hem=W}} → {{#expr: (
 {{#switch: W
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:119|abs119|0}}
 +
 {{#if:34|abs34/60|0}}
 +
 {{#if:04|abs04/3600|0}} )

) round {{#if: | | 7 }} }}

When using unnamed parameters, the hemisphere must be the fourth parameter:

{{decdeg|37|51||N}} → {{#expr: (
 {{#switch: N
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:37|abs37|0}}
 +
 {{#if:51|abs51/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|119|34||W}} → {{#expr: (
 {{#switch: W
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:119|abs119|0}}
 +
 {{#if:34|abs34/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

Input can be signed or unsigned decimal degrees:

{{decdeg|37.85|||N}} → {{#expr: (
 {{#switch: N
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:37.85|abs37.85|0}}
 +
 {{#if:|abs/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|119.5666667|||W}} → {{#expr: (
 {{#switch: W
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:119.5666667|abs119.5666667|0}}
 +
 {{#if:|abs/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|37.85}} → {{#expr: (
 {{#switch: 
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:37.85|abs37.85|0}}
 +
 {{#if:|abs{{{2}}}/60|0}}
 +
 {{#if:|abs{{{3}}}/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|-119.5666667}} → {{#expr: (
 {{#switch: 
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:-119.5666667|abs-119.5666667|0}}
 +
 {{#if:|abs{{{2}}}/60|0}}
 +
 {{#if:|abs{{{3}}}/3600|0}} )

) round {{#if: | | 7 }} }}

When using rounding, the factor must be the fifth parameter:

{{decdeg|37.85||||1}} → {{#expr: (
 {{#switch: 
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:37.85|abs37.85|0}}
 +
 {{#if:|abs/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: 1 | 1 | 7 }} }}

{{decdeg|-119.5666667||||1}} → {{#expr: (
 {{#switch: 
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:-119.5666667|abs-119.5666667|0}}
 +
 {{#if:|abs/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: 1 | 1 | 7 }} }}

If a value is undefined then zero is assumed:

{{decdeg||51||N}} → {{#expr: (
 {{#switch: N
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:|abs|0}}
 +
 {{#if:51|abs51/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg||34||W}} → {{#expr: (
 {{#switch: W
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:|abs|0}}
 +
 {{#if:34|abs34/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

Negative zero values are accommodated:

{{decdeg|0|51}} → {{#expr: (
 {{#switch: N
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:|abs|0}}
 +
 {{#if:51|abs51/60|0}}
 +
 {{#if:|abs/3600|0}} )

) round {{#if: | | 7 }} }}

{{decdeg|-0|34}} → {{#expr: (
 {{#switch: 
w|S|s = -1 e|N|n = 1 - | -1 | 1 }}
 }}
 * (
 {{#if:-0|abs-0|0}}
 +
 {{#if:34|abs34/60|0}}
 +
 {{#if:|abs{{{3}}}/3600|0}} )

) round {{#if: | | 7 }} }}

See also[uredi]