... ho modificato agiungendo isset ...

---------------------------------------
<?php
$url="http://overpass-api.de/api/interpreter?data=[out:json];node(45.59374,8.92399,45.60718,8.94424);out;";
$json = file_get_contents($url); $data = json_decode($json, TRUE);

foreach($data['elements']  as $obj) {
    if (isset($obj['tags'])) {
    $lat=$obj['lat'];
    $lon=$obj['lon'];
    
        foreach($obj['tags'] as $obj1) {
            if (isset($obj1['wikipedia'])) {
            echo "lat:$lat; lon:$lon; ";
            echo $obj1['wikipedia'];
            echo "<br>";
            }
            else {}
        }
    }
    else {}
}

?>
---------------------------------------
Funziona il primo for each, ma il secondo รจ come se mi restituisce la prima
lettera e poi di tutti i tag, non solo quello con 'wikipedia'

se provo a mettere al posto di echo $obj1['wikipedia']; solo echo $obj1; mi
restituisce tutti i valori del tag completi ...

l'esempio col codice aggiornato: 
http://host.logosloci.com/test/parse_json.php
<http://host.logosloci.com/test/parse_json.php>  



--
View this message in context: 
http://gis.19327.n5.nabble.com/Caricare-info-node-OSM-direttamente-su-OpenLayers-tp5759882p5760118.html
Sent from the Italy General mailing list archive at Nabble.com.

_______________________________________________
Talk-it mailing list
Talk-it@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-it

Rispondere a