Vorlage:Entfernung
(Unterschied zwischen Versionen)
Zeile 9: | Zeile 9: | ||
Linnich<br> | Linnich<br> | ||
Geo: {{#show: Linnich|?Geo}}<br /> | Geo: {{#show: Linnich|?Geo}}<br /> | ||
− | k1: {{#vardefine:k1|50. | + | k1: {{#vardefine:k1|50.7723425, 06.0772938|format=float|directional=no}}}}{{#var:k1}}<br> |
b1: {{#vardefine:b1|{{#explode:{{#var:k1}}|,|0}}}}{{#var:b1}}<br> | b1: {{#vardefine:b1|{{#explode:{{#var:k1}}|,|0}}}}{{#var:b1}}<br> | ||
l1: {{#vardefine:l1|{{#explode:{{#var:k1}}| |1}}}}{{#var:l1}}<br> | l1: {{#vardefine:l1|{{#explode:{{#var:k1}}| |1}}}}{{#var:l1}}<br> | ||
Zeile 17: | Zeile 17: | ||
Aachen<br> | Aachen<br> | ||
{{#show: Aachen|?Geo}}<br> | {{#show: Aachen|?Geo}}<br> | ||
− | k2: {{#vardefine:k2|50. | + | k2: {{#vardefine:k2|50.7499400, 06.0876100|format=float|directional=no}}}}{{#var:k2}}<br> |
b2: {{#vardefine:b2|{{#explode:{{#var:k2}}|,|0}}}}{{#var:b2}}<br> | b2: {{#vardefine:b2|{{#explode:{{#var:k2}}|,|0}}}}{{#var:b2}}<br> | ||
l2: {{#vardefine:l2|{{#explode:{{#var:k2}}| |1}}}}{{#var:l2}}<br> | l2: {{#vardefine:l2|{{#explode:{{#var:k2}}| |1}}}}{{#var:l2}}<br> | ||
Zeile 25: | Zeile 25: | ||
geodistance | geodistance | ||
− | {{#vardefine:e|{{#geodistance:50. | + | {{#vardefine:e|{{#geodistance:50.7723425, 06.0772938|50.7499400, 06.0876100|unit=km}}}} e: {{#var:e}} |
{{#vardefine:l|{{#LEN:{{#var:e}}}}}} l: {{#var:l}} | {{#vardefine:l|{{#LEN:{{#var:e}}}}}} l: {{#var:l}} | ||
{{#vardefine:ll|{{#expr:{{#var:l}}-3}}}} ll: {{#var:ll}} | {{#vardefine:ll|{{#expr:{{#var:l}}-3}}}} ll: {{#var:ll}} | ||
− | {{#replace:{{#sub:{{#var:e}}|0|{{#var:ll}}}}|,|.}} | + | {{#expr:{{#replace:({{#sub:{{#var:e}}|0|{{#var:ll}}}}|,|.}} - 0.05) round 1}} |
− | Entfernung: {{#expr:{{#expr:6378.137*acos(sin{{#var:bb1}}*sin{{#var:bb2}}+cos({{#var:bb1}})*cos{{#var:bb2}}*cos({{#var:ll2}}-{{#var:ll1}}))}} round | + | Entfernung: {{#expr:({{#expr:6378.137*acos(sin{{#var:bb1}}*sin{{#var:bb2}}+cos({{#var:bb1}})*cos{{#var:bb2}}*cos({{#var:ll2}}-{{#var:ll1}}))}}- 0.05) round 1}} km |
− | </noinclude><includeonly>{{#vardefine:b1|{{#explode:{{{1|}}}|,|0}}}}{{#vardefine:l1|{{#explode:{{{1|}}}| |1}}}}{{#vardefine:bb1|{{#expr:{{#var:b1}}*pi/180}}}}{{#vardefine:ll1|{{#expr:{{#var:l1}}*pi/180}}}}{{#vardefine:b2|{{#explode:{{{2|}}}|,|0}}}}{{#vardefine:l2|{{#explode:{{{2|}}}| |1}}}}{{#vardefine:bb2|{{#expr:{{#var:b2}}*pi/180}}}}{{#vardefine:ll2|{{#expr:{{#var:l2}}*pi/180}}}}{{#expr:{{#expr:6378.137*acos(sin{{#var:bb1}}*sin{{#var:bb2}}+cos({{#var:bb1}})*cos{{#var:bb2}}*cos({{#var:ll2}}-{{#var:ll1}}))}} round 2}} | + | </noinclude><includeonly>{{#vardefine:e|{{#geodistance:{{{1|}}}|{{{2|}}}|unit=km}}}}{{#vardefine:l|{{#LEN:{{#var:e}}}}}}{{#vardefine:ll|{{#expr:{{#var:l}}-3}}}}{{#expr:{{#replace:{{#sub:{{#var:e}}|0|{{#var:ll}}}}|,|.}} - 0.05) round 1}}</includeonly><!-- |
+ | {{#vardefine:b1|{{#explode:{{{1|}}}|,|0}}}}{{#vardefine:l1|{{#explode:{{{1|}}}| |1}}}}{{#vardefine:bb1|{{#expr:{{#var:b1}}*pi/180}}}}{{#vardefine:ll1|{{#expr:{{#var:l1}}*pi/180}}}}{{#vardefine:b2|{{#explode:{{{2|}}}|,|0}}}}{{#vardefine:l2|{{#explode:{{{2|}}}| |1}}}}{{#vardefine:bb2|{{#expr:{{#var:b2}}*pi/180}}}}{{#vardefine:ll2|{{#expr:{{#var:l2}}*pi/180}}}}{{#expr:{{#expr:6378.137*acos(sin{{#var:bb1}}*sin{{#var:bb2}}+cos({{#var:bb1}})*cos{{#var:bb2}}*cos({{#var:ll2}}-{{#var:ll1}}))}} round 2}} | ||
+ | --> |
Version vom 26. März 2014, 22:25 Uhr
Input: Geokoordinate 1 {{{1}}} Geokoordinate 2 {{{2}}} Output: Entfernung=ARCCOS[ SIN(Breite1)*SIN(Breite2) + COS(Breite1)*COS(Breite2)*COS(Länge2-Länge1) ] * 6378,137
Beispiel: Geokoordinate 1: Linnich: 50.977773, 6.268931 (lat, lon) (breite,länge) Geokoordinate 2: Aachen: 50.7753455, 6.0838868
Linnich
Geo:
k1: }}50.7723425, 06.0772938
b1: 50.7723425
l1: 06.0772938
bb1:0.886144545575
ll1:0.106068786421
Aachen
k2: }}50.7499400, 06.0876100
b2: 50.7499400
l2: 06.0876100
bb2:0.88575354819
ll2:0.106248838077
geodistance
e: 2,59 km l: 7 ll: 4
2.5
Entfernung: 2.5 km