Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
R = 6371;
dlon = deg2rad(B_lon - A_lon);
dlat = deg2rad(B_lat - A_lat);
a = (sin(dlat/2))^2 + cos(deg2rad(A_lat)) * cos(deg2rad(B_lat)) * (sin(dlon/2))^2;
c = 2 * asin(min(1,sqrt(a)));
d = R * c;
<?php header("Content-type: image/svg+xml");
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
echo '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
echo '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="512" stroke="red" fill="none" viewBox="-180 -90 360 180" stroke-width="0.3">';
echo "<defs><g id='Kreuz'>";
echo '<line x1="-1" y1="-1" x2="1" y2="1" />';
echo '<line x1="-1" y1="1" x2="1" y2="-1" />';
echo'</g></defs>';
echo '<image x="-180" y="-90" width="360" height="180" xlink:href="http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg" />';
echo "\n\r";
$Erdradius=6371;
$Daten=
array(
"48°8'N 11°34'O München",
"25°15'N 55°18'O Dubai",
"39°54'50\"N 116°23'30\"O Peking",
"33°51'S 151°12'O Sydney",
"26°12'S 28°4'O Johannesburg",
"22°54'S 43°12'W Rio de Janeiro",
"37°47'N 122°25'W San Francisco",
"40°43'N 74°0'W New York",
"51°31'N 0°7'W London",
"48°8'N 11°34'O München"
);
$Punkte=count($Daten);
for($i=0;$i<($Punkte-1);$i++)
{
$pattern = "/([\d]+°)*([\d]+')*([\d]+\")*([NS]{1})\s([\d]+°)*([\d]+')*([\d]+\")*([WO]{1})\s([\D]+)/x";
preg_match($pattern,$Daten[$i],$ergA);
preg_match($pattern,$Daten[$i+1],$ergB);
$A_lat=intval(str_replace("°","",$ergA[1]))+intval(str_replace("'","",$ergA[2]))/60+intval(str_replace("\"","",$ergA[3]))/3600;
$A_lon=intval(str_replace("°","",$ergA[5]))+intval(str_replace("'","",$ergA[6]))/60+intval(str_replace("\"","",$ergA[7]))/3600;
$B_lat=intval(str_replace("°","",$ergB[1]))+intval(str_replace("'","",$ergB[2]))/60+intval(str_replace("\"","",$ergB[3]))/3600;
$B_lon=intval(str_replace("°","",$ergB[5]))+intval(str_replace("'","",$ergB[6]))/60+intval(str_replace("\"","",$ergB[7]))/3600;
$dlon = deg2rad($B_lon - $A_lon);
$dlat = deg2rad($B_lat - $A_lat);
$a = pow(sin($dlat/2),2) + cos(deg2rad($A_lat)) * cos(deg2rad($B_lat)) * pow(sin($dlon/2),2);
$c = 2 * asin(min(1,sqrt($a)));
$d = $Erdradius * $c;
echo "<!-- ".$ergA[9].", ".$ergB[9]." = ".$d."km = ".$d*0.621." meilen -->";
echo "\n\r";
// Wenn N lat Vorzeichen umdrehen, lon W vice versa
if($ergA[4]=="N"){$A_lat=-$A_lat;}
if($ergA[8]=="W"){$A_lon=-$A_lon;}
echo '<use xlink:href="#Kreuz" transform="translate('.$A_lon.' '.$A_lat.')" />';
if($ergB[4]=="N"){$B_lat=-$B_lat;}
if($ergB[8]=="W"){$B_lon=-$B_lon;}
echo '<line x1="'.$A_lon.'" y1="'.$A_lat.'" x2="'.$B_lon.'" y2="'.$B_lat.'"/>';
echo "\n\r";
}
?>
</svg>
<?php header("Content-type: image/svg+xml");
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="512"
stroke="red" fill="none" viewBox="-180 -90 360 180" stroke-width="0.3">
<defs><g id='Kreuz'>
<line x1="-1" y1="-1" x2="1" y2="1" />
<line x1="-1" y1="1" x2="1" y2="-1" />
</g></defs>
<image x="-180" y="-90" width="360" height="180" xlink:href="http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg" />
<?php
echo "\n\r";
$Erdradius=6371;
$Daten=
array(
"48°8'N 11°34'O München",
"25°15'N 55°18'O Dubai",
"39°54'50\"N 116°23'30\"O Peking",
"33°51'S 151°12'O Sydney",
"26°12'S 28°4'O Johannesburg",
"22°54'S 43°12'W Rio de Janeiro",
"37°47'N 122°25'W San Francisco",
"40°43'N 74°0'W New York",
"51°31'N 0°7'W London",
"48°8'N 11°34'O München"
);
$Punkte=count($Daten);
for($i=0;$i<($Punkte-1);$i++)
{
$pattern = "/([\d]+°)*([\d]+')*([\d]+\")*([NS]{1})\s([\d]+°)*([\d]+')*([\d]+\")*([WO]{1})\s([\D]+)/x";
preg_match($pattern,$Daten[$i],$ergA);
preg_match($pattern,$Daten[$i+1],$ergB);
//Einheiten rausnehmen und Winkel berechnen
$A_lat=intval(str_replace("°","",$ergA[1]))+intval(str_replace("'","",$ergA[2]))/60+intval(str_replace("\"","",$ergA[3]))/3600;
$A_lon=intval(str_replace("°","",$ergA[5]))+intval(str_replace("'","",$ergA[6]))/60+intval(str_replace("\"","",$ergA[7]))/3600;
$B_lat=intval(str_replace("°","",$ergB[1]))+intval(str_replace("'","",$ergB[2]))/60+intval(str_replace("\"","",$ergB[3]))/3600;
$B_lon=intval(str_replace("°","",$ergB[5]))+intval(str_replace("'","",$ergB[6]))/60+intval(str_replace("\"","",$ergB[7]))/3600;
// Grad zu rad
$A_lat=deg2rad($A_lat);
$A_lon=deg2rad($A_lon);
$B_lat=deg2rad($B_lat);
$B_lon=deg2rad($B_lon);
// Vorzeichen umkehren für N lat und W lon
if($ergA[4]=="N"){$A_lat=-$A_lat;}
if($ergA[8]=="W"){$A_lon=-$A_lon;}
// für die Loxodrome (und die Entfernung d) auch den 2.Punkt bearbeiten
if($ergB[4]=="N"){$B_lat=-$B_lat;}
if($ergB[8]=="W"){$B_lon=-$B_lon;}
// Haversine
$dlon = $B_lon - $A_lon;
$dlat = $B_lat - $A_lat;
$a = pow(sin($dlat/2),2) + cos($A_lat) * cos($B_lat) * pow(sin($dlon/2),2);
$c = 2 * asin(min(1,sqrt($a)));
$d = $Erdradius * $c;
// Startwinkel des Fluges
$y = sin($dlon) * cos($B_lat);
$x = cos($A_lat)*sin($B_lat) -sin($A_lat)*cos($B_lat)*cos($dlon);
$brng = atan2($y, $x);
// Comment in der SVG
echo "<!-- ".$ergA[9].", ".$ergB[9]." = ".$d."km = ".$d*0.621." meilen & Startwinkel :".rad2deg($brng)."° -->";
echo "\n\r";
// Jeder nur ein Kreuz
echo '<use xlink:href="#Kreuz" transform="translate('.rad2deg($A_lon).' '.rad2deg($A_lat).')" />';
echo "\n\r";
//Loxodrom in Gruen zeichnen
echo '<line x1="'.rad2deg($A_lon).'" y1="'.rad2deg($A_lat).'" x2="'.rad2deg($B_lon).'" y2="'.rad2deg($B_lat).'" ';
echo 'style="stroke:rgb(0,255,0);stroke-width:0.2"/>';
echo "\n\r";
//Orthodrome zeichnen - bestehend aus $sAnz Stützpunkten
$sAnz=20;
$ddist=$d/$sAnz;
// Startpunkt der SVG-Linie
echo '<path d="M'.rad2deg($A_lon).' '.rad2deg($A_lat);
for($multi=0;$multi<($sAnz+1);$multi++)
{
//Wegpunkt anhand Initialwinkel und Entfernung
$ddd=$ddist*$multi;
$ddlat = asin( sin($A_lat)*cos($ddd/$Erdradius) + cos($A_lat)*sin($ddd/$Erdradius)*cos($brng) );
$ddlon = $A_lon + atan2(sin($brng)*sin($ddd/$Erdradius)*cos($A_lat),cos($ddd/$Erdradius)-sin($A_lat)*sin($B_lat));
// weiteren Punkt in der SVG-Path setzen
echo ' L'.number_format(rad2deg($ddlon),1).' '.number_format(rad2deg($ddlat),1);
}
//SVG Path schließen
echo '"/>';
echo "\n\r";
}
?>
</svg>
/(\d+°)*(\d+')*(\d+\")*([NS])\s(\d+°)*(\d+')*(\d+\")*([WO])\s(\D+)/
$degree_pattern = "(\d+°)?(\d+')?(\d+\")?";
$pattern = "/^\s*$degree_pattern([NS])\s+$degree_pattern([WO])\s+(.+)\$/"