anto80 / osrm-api-client
该软件包最新版本(1.0-stable)的许可证信息不可用。
OSRM项目的API客户端
1.0-stable
2016-08-12 09:30 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-23 12:25:27 UTC
README
osrm-api-client 是一个开源的PHP实现,用于OSRM服务器API。
###功能
- viaroute(计算两点之间道路网络上的最短路径)
- locate(道路网络中最近的节点)
- nearest(道路网络中任何街道段上的最近点)
###安装要将它作为本地项目依赖项添加,您可以将以下代码插入到您的composer.json文件中
{
"require": {
"anto80/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