I have asked in two earlier questions to place multiple markers from a XML file created from Lightroom, which had to be tranformed in degrees instead of Degrees,Minutes,Seconds. This part i managed but then...
Önceki soruya cevaplar çok bilgilendirici ama ben sadece bunu çözmek için yönetemez programlama benim zavallı beceri (ilk proje) bulunuyor.
Sorun i birden fazla belirteci göstermek istiyorum.
tam kod:
<?php
require('GoogleMapAPI.class.php');
$objDOM = new DOMDocument("1.0", 'utf-8');
$objDOM->preserveWhiteSpace = false;
$objDOM->load("googlepoints.xml"); //make sure path is correct
$photo = $objDOM->getElementsByTagName("photo");
foreach ($photo as $value) {
$album = $value->getElementsByTagName("album");
$albu = $album->item(0)->nodeValue;
$description = $value->getElementsByTagName("description");
$descriptio = $description->item(0)->nodeValue;
$title = $value->getElementsByTagName("title");
$titl = $title->item(0)->nodeValue;
$link = $value->getElementsByTagName("link");
$lin = $link->item(0)->nodeValue;
$guid = $value->getElementsByTagName("guid");
$gui = $guid->item(0)->nodeValue;
$gps = $value->getElementsByTagName("gps");
$gp = $gps->item(0)->nodeValue;
$Deglon = str_replace("'", "/", $gp);
$Deglon = str_replace("°", "/", $Deglon);
$Deglon = str_replace("", "/", $Deglon);
$str = $Deglon;
$arr1 = str_split($str, 11);
$date = $arr1[0]; // Delimiters may be slash, dot, or hyphen
list ($latdeg, $latmin, $latsec, $latrichting) = split ('[°/".-]', $date);
$Lat = $latdeg + (($latmin + ($latsec/60))/60);
$latdir = $latrichting.$Lat;
If (preg_match("/N /", $latdir)) {$Latcoorl = str_replace(" N ", "+",$latdir);}
else {$Latcoorl = str_replace ("S ", "-",$latdir);}
//$Latcoord=$Latcoorl.",";
$date1 = $arr1[1]; // Delimiters may be slash, dot, or hyphen
list ($londeg, $lonmin, $lonsec, $lonrichting) = split ('[°/".-]', $date1);
$Lon = $londeg + (($lonmin + ($lonsec/60))/60);
$londir = $lonrichting.$Lon;
If (preg_match("/W /", $londir)) {$Loncoorl = str_replace("W ", "+",$londir);}
else {$Loncoorl = str_replace ("E", "-",$londir);}
$Lonarr = array($Loncoorl);
foreach ($Lonarr as &$LonArray);
$Latarr = array($Latcoorl);
foreach ($Latarr as &$LatArray);
$titarr = array($titl);
foreach ($titarr as &$titArray);
$guarr = array($gui);
foreach ($guarr as &$guaArray);
$albuarr = array($albu);
foreach ($albuarr as &$albuArray);
print_r ($LonArray);
print_r ($LatArray);
print_r ($guaArray);
print_r ($albuArray);
$map = new GoogleMapAPI('map');
// setup database for geocode caching
// $map->setDSN('mysql://USER:PASS@localhost/GEOCODES');
// enter YOUR Google Map Key
$map->setAPIKey('ABQIAAAAiA4e9c1IW0MDrtoPQRaLgRQmsvD_kVovrOh_CkQEnehxpBb-yhQq1LkA4BJtjWw7lWmjfYU8twZvPA');
$map->addMarkerByCoords($LonArray,$LatArray,$albuArray,$guaArray);
}
?>
Sorun olduğunu "$ haritası-> addMarkerByCoords ($ LonArray, $ LatArray, $ albuArray, $ guaArray);" Sadece son değer adlı 4 dizileri gösterir.
Ve oluşturulan yalnızca bir işaret var orada ön plana.
Örneğin çıkış (print_r) $ guaArray IMG_3308IMG_3309IMG_3310IMG_3311IMG_3312 (5 isim dosya adı en fotoğraflarından) 'dir.
'GoogleMapAPI.class.php' dan işlevi addMarkersByCoords şöyle:
function addMarkerByCoords($lon,$lat,$title = '',$html = '',$tooltip = '') {
$_marker['lon'] = $lon;
$_marker['lat'] = $lat;
$_marker['html'] = (is_array($html) || strlen($html) > 0) ? $html : $title;
$_marker['title'] = $title;
$_marker['tooltip'] = $tooltip;
$this->_markers[] = $_marker;
$this->adjustCenterCoords($_marker['lon'],$_marker['lat']);
// return index of marker
return count($this->_markers) - 1;
}
Birisi bana yardımcı olabilir umuyoruz?