Skip to content

shadow-software/osm-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwaggerClient-php

With the GraphHopper Directions API you can integrate A-to-B route planning, turn-by-turn navigation, route optimization, isochrone calculations and other tools in your application. The GraphHopper Directions API consists of the following RESTful web services: * Routing API, * Route Optimization API, * Isochrone API, * Map Matching API, * Matrix API, * Geocoding API and * Cluster API. # Explore our APIs ## Get started 1. Sign up for GraphHopper 2. Create an API key Each API part has its own documentation. Jump to the desired API part and learn about the API through the given examples and tutorials. In addition, for each API there are specific sample requests that you can send via Insomnia or Postman to see what the requests and responses look like. ## Insomnia To explore our APIs with Insomnia, follow these steps: 1. Open Insomnia and Import our workspace. 2. Specify your API key in your workspace: Manage Environments -> Base Environment -> \"api_key\": your API key 3. Start exploring Insomnia ## Postman To explore our APIs with Postman, follow these steps: 1. Import our request collections as well as our environment file. 2. Specify your API key in your environment: \"api_key\": your API key 3. Start exploring Postman ## API Client Libraries To speed up development and make coding easier, we offer the following client libraries: * JavaScript client - try the live examples * Others like C#, Ruby, PHP, Python, ... automatically created for the Route Optimization API ### Bandwidth reduction If you create your own client, make sure it supports http/2 and gzipped responses for best speed. If you use the Matrix or Route Optimization API and want to solve large problems, we recommend you to reduce bandwidth by compressing your POST request and specifying the header as follows: Content-Encoding: gzip. ## Contact Us If you have problems or questions, please read the following information: - FAQ - Public forum - Contact us To stay informed about the latest developments, you can - follow us on twitter, - read our blog, - watch our documentation, - sign up for our newsletter or - our forum. Select the channel you like the most. # Map Data and Routing Profiles Currently, our main data source is OpenStreetMap. We also integrated other network data providers. This chapter gives an overview about the options you have. ## OpenStreetMap #### Geographical Coverage OpenStreetMap covers the whole world. If you want to see for yourself if we can provide data suitable for your region, please visit GraphHopper Maps. You can edit and modify OpenStreetMap data if you find that important information is missing, e.g. a weight limit for a bridge. Here is a beginner's guide that shows how to add data. If you have edited data, we usually consider your data after 1 week at the latest. #### Supported Vehicle Profiles The Routing, Matrix and Route Optimization APIs support the following vehicle profiles: Name | Description | Restrictions | Icon -----------|:----------------------|:--------------------------|:--------------------------------------------------------- car | Car mode | car access | car image small_truck| Small truck like a Mercedes Sprinter, Ford Transit or Iveco Daily | height=2.7m, width=2+0.4m, length=5.5m, weight=2080+1400 kg | small truck image truck | Truck like a MAN or Mercedes-Benz Actros | height=3.7m, width=2.6+0.5m, length=12m, weight=13000 + 13000 kg, hgv=yes, 3 Axes | truck image scooter | Moped mode | Fast inner city, often used for food delivery, is able to ignore certain bollards, maximum speed of roughly 50km/h | scooter image foot | Pedestrian or walking without dangerous SAC-scales | foot access | foot image hike | Pedestrian or walking with priority for more beautiful hiking tours and potentially a bit longer than foot. Walking duration is influenced by elevation differences. | foot access | hike image bike | Trekking bike avoiding hills | bike access | bike image mtb | Mountainbike | bike access | Mountainbike image racingbike| Bike preferring roads | bike access | racingbike image Please note: * all motor vehicles (car, small_truck, truck and scooter) support turn restrictions via turn_costs=true * the free package supports only the vehicle profiles car, bike or foot * up to 2 different vehicle profiles can be used in a single optimization request. The number of vehicles is unaffected and depends on your subscription. * we offer custom vehicle profiles with different properties, different speed profiles or different access options. To find out more about custom profiles, please contact us. * a sophisticated motorcycle profile is available up on request. It is powered by the Kurviger Routing API and favors curves and slopes while avoiding cities and highways. ## TomTom If you want to include traffic, you can purchase the TomTom Add-on. This Add-on only uses TomTom's road network and historical traffic information. Live traffic is not yet considered. If you are interested to learn how we consider traffic information, we recommend that you read this article. Please note the following: * Currently we only offer this for our Route Optimization API. * In addition to our terms, you need to accept TomTom's End User License Aggreement. * We do not use TomTom's web services. We only use their data with our software. Contact us for more details. #### Geographical Coverage We offer - Europe including Russia - North, Central and South America - Saudi Arabia - United Arab Emirates - South Africa - Australia #### Supported Vehicle Profiles Name | Description | Restrictions | Icon -----------|:----------------------|:--------------------------|:--------------------------------------------------------- car | Car mode | car access | car image small_truck| Small truck like a Mercedes Sprinter, Ford Transit or Iveco Daily | height=2.7m, width=2+0.4m, length=5.5m, weight=2080+1400 kg | small truck image

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen For more information, please visit https://www.graphhopper.com/

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: api_key
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\Api\ClusterAPIApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Swagger\Client\Model\ClusterRequest(); // \Swagger\Client\Model\ClusterRequest | Request object that contains the problem to be solved

try {
    $result = $apiInstance->asyncClusteringProblem($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClusterAPIApi->asyncClusteringProblem: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: api_key
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\Api\ClusterAPIApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$job_id = "job_id_example"; // string | Request solution with jobId

try {
    $result = $apiInstance->getClusterSolution($job_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClusterAPIApi->getClusterSolution: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: api_key
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\Api\ClusterAPIApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \Swagger\Client\Model\ClusterRequest(); // \Swagger\Client\Model\ClusterRequest | Request object that contains the problem to be solved

try {
    $result = $apiInstance->solveClusteringProblem($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClusterAPIApi->solveClusteringProblem: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://graphhopper.com/api/1

Class Method HTTP request Description
ClusterAPIApi asyncClusteringProblem POST /cluster/calculate Batch Cluster Endpoint
ClusterAPIApi getClusterSolution GET /cluster/solution/{jobId} GET Batch Solution Endpoint
ClusterAPIApi solveClusteringProblem POST /cluster POST Cluster Endpoint
GeocodingAPIApi getGeocode GET /geocode Geocoding Endpoint
IsochroneAPIApi getIsochrone GET /isochrone Isochrone Endpoint
MapMatchingAPIApi postGPX POST /match Map-match a GPX file
MatrixAPIApi calculateMatrix POST /matrix/calculate Batch Matrix Endpoint
MatrixAPIApi getMatrix GET /matrix GET Matrix Endpoint
MatrixAPIApi getMatrixSolution GET /matrix/solution/{jobId} GET Batch Matrix Endpoint
MatrixAPIApi postMatrix POST /matrix POST Matrix Endpoint
RouteOptimizationAPIApi asyncVRP POST /vrp/optimize POST route optimization problem (batch mode)
RouteOptimizationAPIApi getSolution GET /vrp/solution/{jobId} GET the solution (batch mode)
RouteOptimizationAPIApi solveVRP POST /vrp POST route optimization problem
RoutingAPIApi getRoute GET /route GET Route Endpoint
RoutingAPIApi postRoute POST /route POST Route Endpoint
RoutingAPIApi routeInfoGet GET /route/info Coverage information

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

Author

support@graphhopper.com

About

A client for communicating to and from the graphhopper service built on open street maps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published