0

Using a basic reverse geocode request like:

http://nominatim.openstreetmap.org/reverse.php?format=xml&lat=-22.77175&lon=-50.211006

how do i extract the osm_type from the result using PHP?

asked 12 Nov '13, 21:39

tonygil's gravatar image

tonygil
1223
accept rate: 0%


One Answer:
0

using php

$feedUrl = 'http://nominatim.openstreetmap.org/reverse.php?format=xml&lat=-22.77175&lon=-50.211006';
$rawFeed = file_get_contents($feedUrl);
$xml = new SimpleXmlElement($rawFeed);

foreach($xml->result as $result){
        $roadType = $result['osm_type'];
        $osmId = $result['osm_id'];

        echo "Type: $roadType Id: $osmId<br>";
}
permanent link

answered 12 Nov '13, 21:53

tonygil's gravatar image

tonygil
1223
accept rate: 0%

powered by OSQA