Leer gpx con php
Publicado por Javier (49 intervenciones) el 21/11/2012 20:33:03
Hola.
Si quiero leer de un fichero gpx (xml) un datos que se encuentra:
Pero no va.
Un ayuda.
Gracias.
Si quiero leer de un fichero gpx (xml) un datos que se encuentra:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<wpt lat="37.383931" lon="-6.170003" >
<ele>140.4</ele>
<time>2012-10-23T17:59:36.000Z</time>
<name>wpt-2012-10-23T17:59:36.000Z</name>
<type>B</type>
<fix>dgps</fix>
</wpt>
Lo leo asi:
foreach ($xml->wpt as $wpt) {
echo "$wpt->ele<br>";
echo "</ul>";
}
Pero si quiereo leerlo de aqui :
<trk><name>#23084# 2012-10-23T17:52:28.000Z</name><trkseg>
<trkpt lat="37.383557" lon="-6.170081" >
<ele>152.0</ele>
<time>2012-10-23T17:52:28.000Z</time>
<speed>0.1847</speed>
<name>trkpt-2012-10-23T17:52:28.000Z</name>
<type>T</type>
<fix>3d</fix>
</trkpt>
<trkpt lat="37.383534" lon="-6.170023" >
<ele>157.9</ele>
<time>2012-10-23T17:52:33.000Z</time>
<speed>0.2315</speed>
<name>trkpt-2012-10-23T17:52:33.000Z</name>
<type>T</type>
<fix>3d</fix>
</trkpt>
....
<trk>
¿Como leo <ele>... </ele>?
Lo intento asi:
if($xml) {
echo "<ul>";
foreach ($xml->trk ->trkpt as $trk) {
$ele = $trk->ele;
echo "$ele<br>";
echo "</ul>";
}
Pero no va.
Un ayuda.
Gracias.
Valora esta pregunta


0