jens-na / osrm-api-client
本包的最新版本(1.0.0-alpha)没有提供许可证信息。
OSRM项目的API客户端
1.0.0-alpha
2013-07-07 16:45 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-24 05:31:01 UTC
README
osrm-api-client是一个开源的PHP实现,用于OSRM服务器API。
###特性
- viaroute(在道路网络中计算两个坐标之间的最短路径)
- locate(道路网络中的最近节点)
- nearest(道路网络中任何街道段上的最近点)
###安装要将它添加为本地项目依赖,您可以将以下代码插入到您的composer.json文件中
{
"require": {
"jens-na/osrm-api-client": "dev-master"
}
}
###API使用政策如果您使用的是与该API客户端一起使用的服务器router.project-osrm.org,请阅读Project-OSRM的API使用政策。
###viaroute $client = new Osrm\OsrmClient('http://server:5000'); $from = new Osrm\Coordinate(50.142739,9.122257); $to = new Osrm\Coordinate(50.139631,9.107151); $route = $client->getRoute($from, $to);
###locate
$client = new Osrm\OsrmClient('http://server:5000');
$mylocation = new Osrm\Coordinate(9.305283, 50.344735);
$nearestStreet = $client->getNearestNodePoint($mylocation);
###nearest
$client = new Osrm\OsrmClient('http://server:5000');
$mylocation = new Osrm\Coordinate(9.305283, 50.344735);
$nearestStreet = $client->getNearestStreetPoint($mylocation);
参考资料
许可和版权
许可协议为GNU通用公共许可证第3版。
(c) Jens Nazarenus,2013