Skip to content

Area Routing #7161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON ..
cmake --build . --config Release

# TODO: MSVC goes out of memory when building our tests
# - name: Run tests
# shell: bash
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:
build_node_package: true
continue-on-error: true
node: 22
runs-on: macos-15 # arm64
runs-on: macos-15 # arm64
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
Expand Down Expand Up @@ -419,7 +419,7 @@ jobs:
fi
# See: https://github.com/actions/toolkit/issues/946#issuecomment-1590016041
# We need it to be able to access system folders while restoring cached Boost below
- name: Give tar root ownership
- name: Give tar root ownership
if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
run: sudo chown root /bin/tar && sudo chmod u+s /bin/tar

Expand All @@ -429,7 +429,7 @@ jobs:
id: install-boost
with:
boost_version: 1.85.0

- name: Install dev dependencies
run: |
# workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499
Expand Down Expand Up @@ -577,7 +577,7 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
name: logs-${{ matrix.name }}
path: test/logs/

- name: Build Node package
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# Unreleased
- Changes from 6.0.0
- Features
- ADDED: Pedestrian area routing [#7161](https://github.com/Project-OSRM/osrm-backend/pull/7161)

# 6.0.0
- Changes from 6.0.0 RC2: None
Expand Down Expand Up @@ -182,7 +186,7 @@
- CHANGED: Docker build, enabled arm64 build layer [#6172](https://github.com/Project-OSRM/osrm-backend/pull/6172)
- CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [#6175](https://github.com/Project-OSRM/osrm-backend/pull/6175)
- FIXED: Bump CI complete meta job to ubuntu-20.04 [#6323](https://github.com/Project-OSRM/osrm-backend/pull/6323)
- CHANGED: Node packages are now scoped by @project-osrm [#6386](https://github.com/Project-OSRM/osrm-backend/issues/6386)
- CHANGED: Node packages are now scoped by \@project-osrm [#6386](https://github.com/Project-OSRM/osrm-backend/issues/6386)
- Routing:
- CHANGED: Lazily generate optional route path data [#6045](https://github.com/Project-OSRM/osrm-backend/pull/6045)
- FIXED: Completed support for no_entry and no_exit turn restrictions. [#5988](https://github.com/Project-OSRM/osrm-backend/pull/5988)
Expand Down Expand Up @@ -217,7 +221,7 @@
- Build:
- CHANGED: Node binaries now use Github Releases for hosting [#6030](https://github.com/Project-OSRM/osrm-backend/pull/6030)
- Misc:
- FIXED: Upgrade to @mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991)
- FIXED: Upgrade to \@mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991)
- FIXED: `valid` type in documentation examples [#5990](https://github.com/Project-OSRM/osrm-backend/issues/5990)
- FIXED: Remove redundant loading of .osrm.cell_metrics [#6019](https://github.com/Project-OSRM/osrm-backend/issues/6019)
- CHANGED: Increase PackedOSMIDs size to 34 bits. This breaks the **data format** [#6020](https://github.com/Project-OSRM/osrm-backend/issues/6020)
Expand Down
29 changes: 16 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Everyone
# Contributing

## Everyone

Please take some time to review our [code of conduct](CODE-OF-CONDUCT.md) to help guide your interactions with others on this project.

# User
## User

Before you open a new issue, please search for older ones that cover the same issue.
In general "me too" comments/issues are frowned upon.
You can add a :+1: emoji reaction to the issue if you want to express interest in this.

# Developer
## Developer

We use `clang-format` version `15` to consistently format the code base. There is a helper script under `scripts/format.sh`.
The format is automatically checked by the `mason-linux-release` job of a Travis CI build.
To save development time a local hook `.git/hooks/pre-push`

```
#!/bin/sh

Expand All @@ -28,16 +31,16 @@ if [ x"$remote" = xorigin ] ; then
fi
fi
```

could check code format, modify a local repository and reject push due to unstaged formatting changes.
Also `pre-push` hook rejects direct pushes to `origin/master`.
Also `pre-push` hook rejects direct pushes to `origin/master`.

⚠️ `scripts/format.sh` checks all local files that match `*.cpp` or `*.hpp` patterns.


In general changes that affect the API and/or increase the memory consumption need to be discussed first.
Often we don't include changes that would increase the memory consumption a lot if they are not generally usable (e.g. elevation data is a good example).

## Pull Request
### Pull Request

Every pull-request that changes the API needs to update the docs in `docs/http.md` and add an entry to `CHANGELOG.md`.
Breaking changes need to have a BREAKING prefix. See the [releasing documentation](docs/releasing.md) on how this affects the version.
Expand All @@ -57,25 +60,25 @@ If you do have commit access there are in general two accepted styles to merging

1. Make sure the branch is up to date with `master`. Run `git rebase master` to find out.
2. Once that is ensured you can either:
- Click the nice green merge button (for a non-fast-forward merge)
- Merge by hand using a fast-forward merge

- Click the nice green merge button (for a non-fast-forward merge)
- Merge by hand using a fast-forward merge

Which merge you prefer is up to personal preference. In general it is recommended to use fast-forward merges because it creates a history that is sequential and easier to understand.

# Maintainer
## Maintainer

## Doing a release
### Doing a release

There is an in-depth guide around how to push out a release once it is ready [here](docs/releasing.md).

## The API
### The API

Changes to the API need to be discussed and signed off by the team. Breaking changes even more so than additive changes.

## Milestones
### Milestones

If a pull request or an issue is applicable for the current or next milestone, depends on the target version number.
Since we use semantic versioning we restrict breaking changes to major releases.
After a Release Candidate is released we usually don't change the API anymore if it is not critical.
Bigger code changes after a RC was released should also be avoided.

5 changes: 2 additions & 3 deletions Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ QUIET = YES

INPUT = @CMAKE_CURRENT_SOURCE_DIR@
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/README.md
FILE_PATTERNS = *.h *.hpp *.c *.cc *.cpp *.md
FILE_PATTERNS = *.h *.hpp *.c *.cc *.cpp *.md *.dox
RECURSIVE = YES

EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/third_party \
@CMAKE_CURRENT_SOURCE_DIR@/build \
@CMAKE_CURRENT_SOURCE_DIR@/node_modules \
@CMAKE_CURRENT_SOURCE_DIR@/unit_tests \
@CMAKE_CURRENT_SOURCE_DIR@/benchmarks \
@CMAKE_CURRENT_SOURCE_DIR@/benchmarks \
@CMAKE_CURRENT_SOURCE_DIR@/features

SOURCE_BROWSER = YES
Expand All @@ -40,5 +40,4 @@ CALLER_GRAPH = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_GRAPH_MAX_NODES = 500
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = YES
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Open Source Routing Machine

# Open Source Routing Machine

[![osrm-backend CI](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml/badge.svg)](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) [![Discord](https://img.shields.io/discord/1034487840219860992)](https://discord.gg/es9CdcCXcb)

High performance routing engine written in C++ designed to run on OpenStreetMap data.

The following services are available via HTTP API, C++ library interface and NodeJs wrapper:

- Nearest - Snaps coordinates to the street network and returns the nearest matches
- Route - Finds the fastest route between coordinates
- Table - Computes the duration or distances of the fastest route between all pairs of supplied coordinates
Expand All @@ -18,6 +18,7 @@ To quickly try OSRM use our [demo server](http://map.project-osrm.org) which com
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [the OSM wiki on routing](https://wiki.openstreetmap.org/wiki/Routing) or [this guide about mapping for navigation](https://web.archive.org/web/20221206013651/https://labs.mapbox.com/mapping/mapping-for-navigation/).

Related [Project-OSRM](https://github.com/Project-OSRM) repositories:

- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
- [osrm-backend-docker](https://github.com/project-osrm/osrm-backend/pkgs/container/osrm-backend) - Ready to use Docker images
Expand All @@ -28,7 +29,6 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:

- [Hosted documentation](http://project-osrm.org)
- [osrm-routed HTTP API documentation](docs/http.md)
- [libosrm API documentation](docs/libosrm.md)

## Contact

Expand All @@ -41,6 +41,7 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
The easiest and quickest way to setup your own routing engine is to use Docker images we provide.

There are two pre-processing pipelines available:

- Contraction Hierarchies (CH)
- Multi-Level Dijkstra (MLD)

Expand Down Expand Up @@ -86,13 +87,13 @@ After adding yourself to the `docker` group make sure to log out and back in aga

We support the following images in the Container Registry:

Name | Description
-----|------
`latest` | `master` compiled with release flag
`latest-assertions` | `master` compiled with with release flag, assertions enabled and debug symbols
`latest-debug` | `master` compiled with debug flag
`<tag>` | specific tag compiled with release flag
`<tag>-debug` | specific tag compiled with debug flag
| Name | Description |
| ------------------- | ------------------------------------------------------------------------------ |
| `latest` | `master` compiled with release flag |
| `latest-assertions` | `master` compiled with with release flag, assertions enabled and debug symbols |
| `latest-debug` | `master` compiled with debug flag |
| `<tag>` | specific tag compiled with release flag |
| `<tag>-debug` | specific tag compiled with debug flag |

### Building from Source

Expand Down Expand Up @@ -166,7 +167,6 @@ For usage details have a look [these API docs](docs/nodejs/api.md).

An exemplary implementation by a 3rd party with Docker and Node.js can be found [here](https://github.com/door2door-io/osrm-express-server-demo).


## References in publications

When using the code in a (scientific) publication, please cite
Expand Down
4 changes: 2 additions & 2 deletions cucumber.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld --require features/support --require features/step_definitions',
ch: '--strict --tags ~@stress --tags ~@todo --tags ~@mld -f progress --require features/support --require features/step_definitions',
ch: '--strict --tags ~@stress --tags ~@todo --tags ~@mld --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress'
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions'
};
109 changes: 109 additions & 0 deletions docs/areas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# How to route inside pedestrian areas {#pedestrian_areas}

How to route inside pedestrian areas, or over the interior of an area where you can
travel freely in all directions.

%OSRM can create routes crossing the interior of an area by generating virtual ways
between every pair of entry points to the area. This process is called @em meshing. The
generated ways follow lines of sight, avoid obstacles, and use existing nodes. An entry
point is where another way connects to the perimeter of the area.

This feature is still EXPERIMENTAL.

## Configuration

To opt-in to this feature, you must declare an algorithm to be used for area meshing.
Find your LUA profile's @ref setup function and insert this line:

```lua
function setup()
...
area_manager:init('visgraph+dijkstra')
...
end
```

Note: Only the `visgraph+dijkstra` algorithm is available at present.

All areas to be meshed must be registered with the @ref AreaManager. In OpenStreetMap <a
href="https://wiki.openstreetmap.org/wiki/Tag:highway%3Dpedestrian#Squares_and_plazas">
areas are mapped</a> either as a closed way or as a multipolygon relation. Both flavours
must be configured separately.

### Meshing closed ways

To mesh a closed way you must register it in your @ref process_way function. Insert
following lines into your existing `process_way` function, immediately after the "quick
initial test":

```lua
function process_way(profile, way, result, relations)
...
if way:has_tag('highway', 'pedestrian') and way:has_true_tag('area') then
-- register the way
area_manager:way(way)
return
end
...
end
```

(Note that open ways cannot be meshed and will be ignored.)

### Meshing multipolygon relations

To mesh a multipolygon relation you must register it in the @ref process_relation
function. The `process_relation` function is a newly introduced function that is called
for every relation in the input file. You'll have to create the function like this:

```lua
function process_relation(profile, relation, relations)
if relation:has_tag('type', 'multipolygon') and relation:has_tag('highway', 'pedestrian') then
-- register the relation
area_manager:relation(relation)
end
end
```

And you must also return the `process_relation` function at the end of your profile:

```lua
return {
setup = setup,
process_way = process_way,
process_node = process_node,
process_relation = process_relation, -- << add this line
...
}
```

At this point you have a working basic configuration. Remember that you must run
`osrm-extract` before your changes become effective.

### Processing the generated ways

While not necessary, you may want to apply further processing to the @em generated ways.
The generated ways are passed to the @ref process_way function in the usual fashion.
They have the same tags as the original way or relation, except:

- the `area` tag is removed on ways,
- the `type` tag is removed on relations,
- an `osrm:virtual=yes` tag is added.

You can pick generated ways like this:

```lua
function process_way(profile, way, result, relations)
...
if way:has_key('osrm:virtual') then
-- do something with the way here
end
...
end
```

@sa AreaManager
<br> A complete example profile is found in the file: [profiles/foot_area.lua](../profiles/foot_area.lua).
<br> https://wiki.openstreetmap.org/wiki/Relation:multipolygon
<br> https://wiki.openstreetmap.org/wiki/Key:area
<br> https://wiki.openstreetmap.org/wiki/Tag:highway%3Dpedestrian#Squares_and_plazas
Loading
Loading