Skip to content

Commit 2fb8333

Browse files
committed
Create isochrones.php
1 parent 4ef1c1c commit 2fb8333

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

examples/isochrones.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
include __DIR__ . '/../src/autoload.php';
3+
4+
$inst = new \OSRM\Isochrones\OpenRouteService();
5+
6+
$inst->setApiKey('{api_key}');
7+
8+
try {
9+
$response = $inst
10+
->setLocations([[8.681495,49.41461],[8.686507,49.41943]])
11+
->setRange([300,200])
12+
->fetch();
13+
if ($response->isOK())
14+
{
15+
echo '<pre>';
16+
print_r($response->getFeatures());
17+
print_r($response->getBbox());
18+
print_r($response->getMetadata());
19+
var_dump($response->getType());
20+
print_r($response->toArray());
21+
} else {
22+
echo 'Isochrone not found.';
23+
}
24+
} catch (\OSRM\Exception $e) {
25+
echo $e->getMessage();
26+
} catch (Exception $e) {
27+
echo $e->getMessage();
28+
}

0 commit comments

Comments
 (0)