geocode
Data de postagem: 06/06/2012 23:30:00
geocode(
Double latitude,
Double longitude,
Integer maxResults[optional, default 1]: maximum number of results)
Returns a list of addresses for the given latitude and longitude.
Returns:
A list of addresses.
Exemplo
<?php
// @author: Anton Perkin (anton.perkinAT_NOSP_AMgmail.com)
// http://groups.google.com/group/php-for-android/browse_thread/thread/bab685d3ae202152
include("Android.php");
$droid = new Android();
//creates alert
$droid->dialogCreateAlert();
$result = array();
//gets coordinates
$latitude = $droid->getInput("Location", "Latitude: ");
$longitude= $droid->getInput("Location", "Longitude: ");
//gets the location info
$locations = $droid->geocode($latitude['result'], $longitude['result']);
//parses location info
foreach ($locations['result'] as $location)
{
$location = get_object_vars($location);
//sets location items
foreach ($location as $key => $value)
{
$result[] = ucfirst(str_replace('_', ' ', $key)).': '.$value;
}
}
$droid->dialogSetItems($result);
//displays the box
$droid->dialogShow();
?>