https://github.com/whizsid/outofway
Map Matching Algorithm By PHP
https://github.com/whizsid/outofway
geolocation gps map-matching php pinned
Last synced: 8 months ago
JSON representation
Map Matching Algorithm By PHP
- Host: GitHub
- URL: https://github.com/whizsid/outofway
- Owner: whizsid
- License: mit
- Created: 2019-06-29T23:37:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T07:45:52.000Z (almost 7 years ago)
- Last Synced: 2025-06-17T06:07:34.087Z (12 months ago)
- Topics: geolocation, gps, map-matching, php, pinned
- Language: PHP
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

---
OutOfWay is a map matching library written in PHP. This package will returning matched coordinates when you passed road coordinates and real coordinates.

## Installation
You can install it with composer package manager.
```
composer require whizsid/outofway
```
## Usage
OutOfWay is easy to use. Only you want is call three methods.
```
// Creating new OutOfWay instance
$outOfWay = new OutOfWay;
// Setting the actual coordinates of the area.
$outOfWay->setActualCoordinates($outOfWay::$helper::parseCoordinates($passed));
// Passing error GPS coordinates
$outOfWay->setVehicleCoordinates($outOfWay::$helper::parseCoordinates($vehicle));
// Getting matched coordinates
$outOfWay->getMatchedCoordinates();
```
You want to pass a multidimentional array that containing `lat`,`lng` keys for each sub arrays to `Helper::parseCoordinates` method.
This `getMatchedCoordinate()` method will return an array of `Coordinate` instances. You can use `getLatitude`,`getLongitude` methods to retrieve latitude and longitude from a `Coordinate`
```
$lat = $coord->getLatitude();
$lng = $coord->getLongitude()
```
## Run Demo
1. Clone the project.
```
git clone https://github.com/whizsid/OutOfWay.git
```
2. Go to the `example` directory
```
cd example
```
3. Install depedencies.
```
composer install
```
4. Run local serve in it and access from web browser.
```
php -S 127.0.0.1:8000
```
## TODO
1. Filtering vehicle coordinates that have more errors.
2. Checking tangent when sorting coordinates from distance.