Skip to content

Commit

Permalink
Create isochrones.php
Browse files Browse the repository at this point in the history
  • Loading branch information
riverside committed Jun 29, 2023
1 parent 4ef1c1c commit 2fb8333
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/isochrones.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
include __DIR__ . '/../src/autoload.php';

$inst = new \OSRM\Isochrones\OpenRouteService();

$inst->setApiKey('{api_key}');

try {
$response = $inst
->setLocations([[8.681495,49.41461],[8.686507,49.41943]])
->setRange([300,200])
->fetch();
if ($response->isOK())
{
echo '<pre>';
print_r($response->getFeatures());
print_r($response->getBbox());
print_r($response->getMetadata());
var_dump($response->getType());
print_r($response->toArray());
} else {
echo 'Isochrone not found.';
}
} catch (\OSRM\Exception $e) {
echo $e->getMessage();
} catch (Exception $e) {
echo $e->getMessage();
}

0 comments on commit 2fb8333

Please sign in to comment.