Skip to content

Instantly share code, notes, and snippets.

@samma835
Created December 6, 2012 03:20
Show Gist options
  • Save samma835/4221569 to your computer and use it in GitHub Desktop.
Save samma835/4221569 to your computer and use it in GitHub Desktop.
SAE地理信息服务
<?php
$api = new apibus(); //创建 ApiBus 对象
$Geo = $api->load( "geoone"); //创建一级地理位置服务对象
// getDriveRoute方法 测试通过
$begin = "121.418687,31.21855";
$end = "121.400263,31.23210";
$drive_route = $Geo->getDriveRoute($begin, $end);
echo "drive_rote: ";
print_r($drive_route);
// getBusRoute方法 测试通过
$begin = "121.418687,31.21855";
$end = "121.400263,31.23210";
$bus_route = $Geo->getBusRoute($begin, $end);
echo "bus_route: ";
print_r($bus_route);
// getBusLine方法 测试通过
$q = "384";
$bus_line = $Geo->getBusLine($q);
echo "bus_line: ";
print_r($bus_line);
// getBusStation方法 测试不通过
$q = urlencode("西直门");
$bus_station = $Geo->getBusStation($q);
echo "bus_station: ";
print_r($bus_station);
/*
// getBusStation方法 输出结果
bus_station: stdClass Object
(
[errcode] => 21903
[errdesc] => Returns no data
)
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment