Skip to content
This repository was archived by the owner on Jun 8, 2024. It is now read-only.
Merged

4.9.0 #130

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a4b9c86
Change release name to track develop
TheMarex Dec 21, 2015
69c0169
Don't specify sub-node version
TheMarex Dec 21, 2015
8273426
Cache OSRM and only build master/develop
TheMarex Dec 21, 2015
00be9f9
Silence npm semver
TheMarex Dec 21, 2015
478dae4
Update package.js
TheMarex Dec 21, 2015
1f9fd4d
Update README
TheMarex Dec 21, 2015
2a1f810
fix linking on osx in debug mode
Dec 15, 2015
ef485b4
remove flto workaround now upstreamed in https://github.com/Project-O…
Dec 15, 2015
c6d74f9
Port to NAN2
TheMarex Dec 15, 2015
1167f7d
Fix LibOSRMConfig code
TheMarex Dec 15, 2015
718b3fe
Remove distance_table parameter test.
TheMarex Dec 15, 2015
9924156
Remove locate tests
TheMarex Dec 15, 2015
fcead02
Add OSRM clang-format
TheMarex Dec 16, 2015
d18e34c
Add missing includes and clangformat
TheMarex Dec 16, 2015
49a218b
Move sharedmemory to own command
TheMarex Dec 17, 2015
5011f4d
Refresh data prepare
TheMarex Dec 17, 2015
b9eedc1
Add HandleScope to each function that creates Local<> objects
TheMarex Dec 17, 2015
50ea678
Fix and restructure tests
TheMarex Dec 17, 2015
54f5614
Update API documentation
TheMarex Dec 22, 2015
5ef7850
Add bearings parameter
TheMarex Dec 23, 2015
b144952
Add tests and fix sources and destinations parameter
TheMarex Dec 23, 2015
860500c
Add more tests for souces/destinations
TheMarex Dec 23, 2015
93a08b2
Update changelog
TheMarex Dec 23, 2015
4ae72c2
Don't use sharedmemory test on MacOS X
TheMarex Dec 24, 2015
d90215d
Use v4.9.0 osrm-backend tag
TheMarex Dec 24, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
ColumnLimit: 100
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Allman
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
...

56 changes: 41 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@ language: cpp
git:
depth: 10

notifications:
email: false

branches:
only:
- master
- develop

cache:
directories:
- node_modules
- deps

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- coreutils
- g++-4.8
- gdb

Expand All @@ -16,45 +30,54 @@ sudo: false

matrix:
include:
# Coverage
- os: osx
compiler: clang
env: NODE_VERSION="0.10" COVERAGE=true TARGET=Debug NPM_FLAGS="--debug"
# Linux
- os: linux
compiler: gcc
env: NODE_VERSION="0.12.0" TARGET=Release
env: NODE_VERSION="5" TARGET=Release
- os: linux
compiler: gcc
env: NODE_VERSION="4" TARGET=Release
- os: linux
compiler: gcc
env: NODE_VERSION="0.10.36" TARGET=Release
env: NODE_VERSION="0.12" TARGET=Release
- os: linux
compiler: gcc
env: NODE_VERSION="0.10.36" TARGET=Debug NPM_FLAGS="--debug"
env: NODE_VERSION="0.10" TARGET=Release
- os: linux
compiler: gcc
env: NODE_VERSION="0.10" TARGET=Debug NPM_FLAGS="--debug"
# OS X
- os: osx
compiler: clang
env: NODE_VERSION="0.12.0" TARGET=Release
env: NODE_VERSION="0.12" TARGET=Release
- os: osx
compiler: clang
env: NODE_VERSION="0.10" TARGET=Release
# Coverage
- os: osx
compiler: clang
env: NODE_VERSION="0.10.36" TARGET=Release
env: NODE_VERSION="0.10" COVERAGE=true TARGET=Debug NPM_FLAGS="--debug"

env:
global:
- JOBS: "3"
- OSRM_RELEASE: "v4.8.1"
- OSRM_RELEASE: "v4.9.0"
- secure: KitzGZjoDblX/3heajcvssGz0JnJ/k02dr2tu03ksUV+6MogC3RSQudqyKY57+f8VyZrcllN/UOlJ0Q/3iG38Oz8DljC+7RZxtkVmE1SFBoOezKCdhcvWM12G3uqPs7hhrRxuUgIh0C//YXEkulUrqa2H1Aj2xeen4E3FAqEoy0=
- secure: WLGmxl6VTVWhXGm6X83GYNYzPNsvTD+9usJOKM5YBLAdG7cnOBQBNiCCUKc9OZMMZVUr3ec2/iigakH5Y8Yc+U6AlWKzlORyqWLuk4nFuoedu62x6ocQkTkuOc7mHiYhKd21xTGMYauaZRS6kugv4xkpGES2UjI2T8cjZ+LN2jU=

before_install:
- scripts/validate_tag.sh
- export COVERAGE=${COVERAGE:-false}
- if [[ $(uname -s) == 'Linux' ]]; then
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export CXX="g++-4.8";
export CC="gcc-4.8";
export PYTHONPATH=$(pwd)/mason_packages/.link/lib/python2.7/site-packages;
else
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export PYTHONPATH=$(pwd)/mason_packages/.link/lib/python/site-packages;
fi;
brew install md5sha1sum;
fi
# Mac OS X does not have nvm installed
- source ./scripts/install_node.sh ${NODE_VERSION}

install:
Expand All @@ -74,5 +97,8 @@ script:
- make test || RESULT=$?
- for i in $(find ./ -maxdepth 1 -name 'core*' -print); do gdb $(which node) $i -ex "thread apply all bt" -ex "set pagination 0" -batch; done;
- if [[ ${RESULT} != 0 ]]; then exit $RESULT; fi
- if [[ ${COVERAGE} == true ]]; then ./mason_packages/.link/bin/cpp-coveralls --exclude node_modules --exclude mason_packages --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi;
- if [[ ${COVERAGE} != true ]]; then ./scripts/publish.sh; fi;
- if [[ ${COVERAGE} == true ]]; then
./mason_packages/.link/bin/cpp-coveralls --exclude node_modules --exclude mason_packages --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen;
else
./scripts/publish.sh;
fi;
100 changes: 58 additions & 42 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,37 @@ Creates a new `osrm` instance

* `options` **`Object`** An object containing osrm options.
* `options.path` **`String`** Path to the [.osrm preprocessed file](https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM#creating-the-hierarchy). If `path` is the the only option, it can be used directly as a string.
* `options.shared_memory` **`[Boolean]`** Allows you to share data among a number of processes and the shared memory used is persistent. It stays in the system until it is explicitly removed.
* `options.distance_table` **`[Number]`** The maximum number of locations in the distance table.
* `options.shared_memory` **`[Boolean]`** Allows you to share data among a number of processes and the shared memory used is persistent. It stays in the system until it is explicitly removed. Use `osrm-datastore` to load new data into memory. Conflicts with `path`.


### Examples

```js
var OSRM = require('osrm');
var osrm = new OSRM('berlin-latest.osrm');
```

Returns `Object` The osrm instance.




## `osrm.locate`

Returns coordinate snapped to nearest node

### Parameters

* `point` **`Array<Number>`** Latitude, longitude pair to locate on the network.


### Examples

```js
var osrm = new OSRM('berlin-latest.osrm');
osrm.locate([52.4224, 13.333086], function(err, result) {
if(err) throw err;
});
var osrm = new OSRM({shared_memory: true});
var osrm = new OSRM(); // same as above
var osrm = new OSRM({path: 'berlin-latest.osrm', shared_memory: true}); // Error only can use either
```

Returns node Location of the nearest node as a latitude, longitude pair.
Returns `Object` The osrm instance.

## `osrm.match`

Matches given coordinates to the road network

### Parameters

* `coordinates` **`Array<Array<Number>>`** The point to match as a latitude, longitude array.
* `timestamps` **`Array<Number>`** An array of UNIX style timestamps corresponding to the input coordinates (eg: 1424684612).
* `classify` **`[Boolean]`** Return a confidence value for this matching. (optional, default `false`)
* `gps_precision` **`[Number]`** Specify gps precision as standart deviation in meters. (optional, default `-1`)
* `matching_beta` **`[Number]`** Specify beta value for matching algorithm. (optional, default `-1`)
* `geometry` **`[Boolean]`** Return the route geometry. (optional, default `true`)
* `compression` **`[Boolean]`** Compress route geometry as a polyline; geometry is an array of [lat, lng] pairs if false. (optional, default `true`)
* `options` **`Object`** Object literal containing parameters for the match query.
* `options.coordinates` **`Array<Array<Number>>`** The point to match as a latitude, longitude array.
* `options.bearings` **`Array<Number>`** or **`Array<Array<Number>>`** Either list of approximate bearing values of the segments to snap to or `[bearing, range]`
* `options.timestamps` **`Array<Number>`** An array of UNIX style timestamps corresponding to the input coordinates (eg: 1424684612).
* `options.classify` **`[Boolean]`** Return a confidence value for this matching. (optional, default `false`)
* `options.gps_precision` **`[Number]`** Specify gps precision as standart deviation in meters. (optional, default `5`)
* `options.matching_beta` **`[Number]`** Specify beta value for matching algorithm. (optional, default `5`)

For other parameters see [osrm.route Parameters](#route_parameters). `trip` does not support computing alternatives.

### Examples

Expand All @@ -70,7 +51,12 @@ osrm.match(options, function(err, response) {
});
```

Returns matchings Array of MatchResults, each containing an object for a partial sub-matching of the trace.
## Errors

* `No route found` No route between the given coordinates could be found.
* `Could not find a matching segment for coordinate` There is not street segment that matches the filters provided.

Returns `Object` containing `matchings` Array of `MatchResult`

## `osrm.nearest`

Expand All @@ -81,7 +67,16 @@ Computes the nearest street segment for a given coordinate.
* `point` **`Array<Number>`** coordinates of the query point as a latitude, longitude array


### Examples

```js
var osrm = new OSRM('berlin-latest.osrm');
osrm.nearest([52.542648,13.393252], function(err, response) {
if(err) throw err;
});
```

Returns `NearestResult` object

## `osrm.route`

Expand All @@ -91,6 +86,7 @@ Computes a route between coordinates over the network.

* `options` **`Object`** Object literal containing parameters for the route query.
* `options.coordinates` **`Array<Array<Number>>`** Via points to route represented by an array of number arrays expressing coordinate pairs as latitude, longitude.
* `options.bearings` **`Array<Number>`** or **`Array<Array<Number>>`** Either list of approximate bearing values of the segments to snap to or `[bearing, range]`
* `options.alternateRoute` **`[Boolean]`** Return an alternate route. (optional, default `false`)
* `options.checksum` **`[Number]`** [Checksum](https://en.wikipedia.org/wiki/Checksum) of the network dataset.
* `options.zoomLevel` **`[Number]`** Determines the level of generalization. The default zoom 18 performs no generalization. (optional, default `18`)
Expand All @@ -117,30 +113,49 @@ Computes distance tables for the given via points. Currently all pair-wise dista

### Parameters

* `coordinates` **`Array<Array<Number>>`** Array of coordinate pairs as latitude, longitude representing the via points to be computed.
* `options` **`Object`** Object literal containing parameters for the table query.
* `options.coordinates` **`Array<Array<Number>>`** Array of coordinate pairs as latitude, longitude representing the via points to be computed.
* `options.sources` **`Array<Array<Number>>`** Array of coordinate pairs as latitude, longitude representing the via points to be computed. Conflicts with `coordinates`.
* `options.destinations` **`Array<Array<Number>>`** Array of coordinate pairs as latitude, longitude representing the via points to be computed. Conflicts with `coordinates`.


### Examples

Computes a 2x2 matrix.

```js
var osrm = new OSRM("berlin-latest.osrm");
var options = {
coordinates: [[52.519930,13.438640], [52.513191,13.415852]]
};
};
osrm.table(options, function(err, table) {
if(err) throw err
});
```

Computes a 1x2 matrix.

```js
var osrm = new OSRM("berlin-latest.osrm");
var options = {
sources: [[52.519930,13.438640]],
destinations: [[52.519930,13.438640], [52.513191,13.415852]]
};
osrm.table(options, function(err, table) {
if(err) throw err
});
```

Returns `TableResult`
Returns `TableResult` object.

## `osrm.trip`

Calculates a short roundtrip that visits every given coordinates
Calculates a short roundtrip that visits every given coordinate.

### Parameters

* `coordinates` **`Array<Array<Number>>`** The point to match as a latitude, longitude array.
* `options` **`Object`** Object literal containing parameters for the trip query.
* `options.coordinates` **`Array<Array<Number>>`** The point to match as a latitude, longitude array.

For other parameters see [osrm.route Parameters](#route_parameters). `trip` does not support computing alternatives.

Expand All @@ -166,6 +181,7 @@ Returns `TripResult`.
| name | type | description |
| ---- | ---- | ----------- |
| `matched_points` | `Array<Array<Number>>` | Coordinates the points snapped to the road network as latitude, longitude pairs. |
| `matched_names` | `Array<String>` | Name of the street the points snapped to. |
| `indices` | `Array<Number>` | Array that gives the indices of the matched coordinates in the original trace. |
| `geometry` | `String` | Geometry of the matched trace in the road network, compressed as a [polyline](https://github.com/mapbox/polyline) with 6 decimals of precision. |
| `confidence` | `Number` | Value between 0 and 1, where 1 is very confident. Please note that the correctness of this value depends highly on [the assumptions about the sample rate](https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-match). |
Expand All @@ -179,7 +195,6 @@ Returns `TripResult`.

| name | type | description |
| ---- | ---- | ----------- |
| `status` | `Number` | 0 if passed, undefined if failed. |
| `mapped_coordinate` | `Array<Number>` | Array that contains the latitude, longitude pair for the snapped coordinate. |
| `name` | `String` | Name of the street the coordinate snapped to. |

Expand All @@ -193,8 +208,6 @@ Returns `TripResult`.

| name | type | description |
| ---- | ---- | ----------- |
| `status` | `Number` | 0 if passed, undefined if failed. |
| `status_message` | `String` | Information about the query results. |
| `via_indices` | `Array<Number>` | Array of node indices corresponding to the via coordinates. |
| `route_geometry` | `String` | Geometry of the suggested route, compressed as a [polyline](https://github.com/mapbox/polyline). |
| `route_summary` | `Object` | Object literal containing an overview of the suggested route. |
Expand All @@ -206,8 +219,9 @@ Returns `TripResult`.
| `found_alternative` | `Boolean` | Value will be `true` if an alternitive route was requested and found. Set options.alternateRoute to `true` to attempt to find an alternate route. |
| `route_name` | `Array<String>` | An array of the most prominent street names along the route. |
| `hint_data` | `Object` | Object literal containing necessary data for speeding up similar queries. |
| `hint_data.locations` | `Array<String>` | An array of [polyline](https://github.com/mapbox/polyline) strings used for incremental hinting. |
| `hint_data.locations` | `Array<String>` | An array of Base64 strings used for incremental hinting. |
| `hint_data.checksum` | `Number` | [Checksum](https://en.wikipedia.org/wiki/Checksum) of the network dataset. |
| `route_instructions` | `Array<Array>** | Array of route instructions. |



Expand All @@ -219,5 +233,7 @@ Returns `TripResult`.
| name | type | description |
| ---- | ---- | ----------- |
| `distance_table` | `Array<Array<Number>>` | Array of arrays that stores the matrix in [row-major order](https://en.wikipedia.org/wiki/Row-major_order). `distance_table[i][j]` gives the travel time from the i-th via to the j-th via point. Values are given in 10th of a second. |
| `source_coodinates` | `Array<Array<Number>>` | Array of `[lat, lon]` pairs representing the snapped coordinate of the source for each row. |
| `destination_coodinates` | `Array<Array<Number>>` | Array of `[lat, lon]` pairs representing the snapped coordinate of the destination for each column. |


6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## node-osrm changelog

### 4.9.0
- Uses OSRM 4.9.0
- `table` now supports `sources` and `destinations` options for asymmetric queries
- `status` and `status_message` were removed. `No route found` (207) and `No matching edge segment found` (208) now throw `Error` Objects (as well as all `400` errors).
- Ported to NAN2 to support for Node 4.x and 5.x

### 4.8.1

- Update OSRM to v4.8.1
Expand Down
Loading