-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
MarcelloPerathoner
wants to merge
8
commits into
Project-OSRM:master
Choose a base branch
from
MarcelloPerathoner:area-routing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Area Routing #7161
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d15c029
Squashed
MarcelloPerathoner 47ffed5
Merge branch 'master' into pr/MarcelloPerathoner/7161
DennisOSRM cfe213f
Fix formatting
DennisOSRM a3efa68
Update util.hpp
DennisOSRM eff7208
Update include/extractor/extraction_relation.hpp
DennisOSRM d73ba7e
Update area_manager.cpp
DennisOSRM 80e4715
Update foot_area.lua
DennisOSRM 5dd5d3b
Merge branch 'master' into area-routing
DennisOSRM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering it it would be better to have an additional
process_area. Right now the flow is a bit weird IMHO because we let this code decide which way/relation is considered an area, which all the consequences of messing that up. That would also safe us from having to expose the area_manager to lua at all from what I can tell.