Skip to content
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

Rjf/map model #255

Merged
merged 63 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5012394
map model with no geom duplication
robfitzgerald Sep 5, 2024
2dbdf4a
vertex oriented rtree, map matching model
robfitzgerald Sep 6, 2024
018c76a
comment
robfitzgerald Sep 30, 2024
5df062c
rename for consistency
robfitzgerald Sep 30, 2024
2f8fbad
projection transforms
robfitzgerald Sep 30, 2024
4134a61
add edge-based map model
robfitzgerald Sep 30, 2024
9a696aa
bugs
robfitzgerald Sep 30, 2024
9fdfeff
hold reference to Edge
robfitzgerald Oct 1, 2024
1568162
move search orientation into core lib
robfitzgerald Oct 1, 2024
08facf1
class for app configuration
robfitzgerald Oct 1, 2024
c1c570f
TryFrom<&Config> for CompassAppConfiguration
robfitzgerald Oct 1, 2024
03d731f
address lifetime errors in map model
robfitzgerald Oct 18, 2024
937d4c9
cleanup imports
robfitzgerald Oct 18, 2024
d2ee544
wire MapModel into CompassApp construction
robfitzgerald Oct 18, 2024
27ecfb7
Merge branch 'main' into rjf/map-model-merge + update
robfitzgerald Dec 5, 2024
97e8f68
Merge branch 'main' into rjf/map-model-merge + update
robfitzgerald Dec 5, 2024
eeaef7d
wire in map model for map matching
robfitzgerald Dec 6, 2024
0bab0bf
MapInputType hard-coded until future work to fix deserialization
robfitzgerald Dec 6, 2024
45f2647
map_input_type argument hidden until future work to fix deserialization
robfitzgerald Dec 6, 2024
f4e58d8
clippy
robfitzgerald Dec 6, 2024
ba40e7e
remove vertex rtree, migrate to spatial index
robfitzgerald Dec 6, 2024
c27fe68
fmt
robfitzgerald Dec 6, 2024
acce104
clippy
robfitzgerald Dec 6, 2024
11ee324
map model replaces rtree plugins, incorporates frontier model
robfitzgerald Dec 10, 2024
6ae835d
clippy
robfitzgerald Dec 10, 2024
c611799
pass e2e test
robfitzgerald Dec 10, 2024
3588add
fmt
robfitzgerald Dec 10, 2024
6bedfd0
rename MapInputType to MatchingType
robfitzgerald Dec 10, 2024
eafc192
fmt
robfitzgerald Dec 10, 2024
d3ffa6d
simplify matching args, graph arg name in search instance
robfitzgerald Dec 10, 2024
e47cc32
update matching_type entry
robfitzgerald Dec 10, 2024
c2adb45
revise API for tolerance for TOML compliance
robfitzgerald Dec 10, 2024
b5b8464
move geometry test
robfitzgerald Dec 10, 2024
e09dc00
module path typos/errors
robfitzgerald Dec 10, 2024
bdcf287
there is no default Edge
robfitzgerald Dec 10, 2024
ad9746a
move unit test setup, but ignore due to integration issues
robfitzgerald Dec 10, 2024
843e64f
cleanup
robfitzgerald Dec 10, 2024
d10c7d5
comment out invalid test stub
robfitzgerald Dec 10, 2024
0f93242
arc wrapper missing
robfitzgerald Dec 10, 2024
f5043e0
clippy
robfitzgerald Dec 10, 2024
a7ce32a
fix tolerance argument format
robfitzgerald Dec 10, 2024
14dfa3f
fix ignore description format
robfitzgerald Dec 10, 2024
c59bb29
fix deserialization for matching types
robfitzgerald Dec 10, 2024
8ce74d7
Merge branch 'main' into rjf/map-model-pymerge
robfitzgerald Dec 10, 2024
28d1635
mypy
robfitzgerald Dec 10, 2024
a3ebc0a
typo
robfitzgerald Dec 10, 2024
6b5a745
typo
robfitzgerald Dec 10, 2024
2f27203
typo
robfitzgerald Dec 10, 2024
dfc823b
error formatting
robfitzgerald Dec 10, 2024
193b5ed
documentation
robfitzgerald Dec 10, 2024
f786549
cleanup
robfitzgerald Dec 10, 2024
bb8e901
remove references to rtree plugins
robfitzgerald Dec 10, 2024
ec93709
print error on failure
robfitzgerald Dec 10, 2024
20683ac
ruff
robfitzgerald Dec 10, 2024
853216a
remove vertex uuid plugin
robfitzgerald Dec 10, 2024
dfb6839
ignore no untyped call
robfitzgerald Dec 10, 2024
6d7fdee
mypy
robfitzgerald Dec 10, 2024
329ff13
use .get to avoid eager failure
robfitzgerald Dec 10, 2024
3be02fc
comments
robfitzgerald Dec 10, 2024
60fe5af
code review cleanup
robfitzgerald Dec 10, 2024
3c4158c
remove proj dependency
robfitzgerald Dec 11, 2024
2c72383
remove UUID plugin
robfitzgerald Dec 11, 2024
3371013
rerun example with latest version
robfitzgerald Dec 11, 2024
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
119 changes: 73 additions & 46 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ We added some annotations to describe the different sections:
# how many threads should a CompassApp use to process queries?
parallelism = 2

# should we begin the search at either: "vertex" or "edge"
search_orientation = "vertex"

# the parameters for the underlying road network graph
[graph]
# a file containing all the graph edges and their adjacencies
Expand All @@ -22,7 +19,20 @@ vertex_list_input_file = "vertices-compass.csv.gz"
# if verbose is true, you'll see more information when loading the graph
verbose = true

# which traversal model to use and its parameters
[mapping]
# vertex or edge-oriented mapping
type = "edge"
# geometries used to build linestrings
geometry_input_file = "edges-geometries-enumerated.txt.gz"
# mapping threshold
tolerance.distance = 15.0
# mapping threshold distance unit
tolerance.unit = "meters"
# allow queries without destinations, for shortest path tree results
queries_without_destinations = true
# whether we match queries via "point", "vertex_id", or "edge_id" (or arrays of combinations)
matching_type = "point"

[traversal]
type = "energy_model"
# the units of the speed table
Expand Down Expand Up @@ -136,8 +146,6 @@ u_turn = 9.5
# which plugins should be activated?
[plugin]
input_plugins = [
# The vertex RTree plugin uses an RTree to match coordiantes to graph verticies.
{ type = "vertex_rtree", distance_tolerance = 0.2, distance_unit = "kilometers", vertices_input_file = "vertices-compass.csv.gz" },
# The grid search allows you to specify a "grid_search" key in the query and it will generate multiple queries from those parameters.
{ type = "grid_search" },
# The load balancer estimates the runtime for each query and is used by CompassApp to best leverage parallelism.
Expand All @@ -151,6 +159,64 @@ output_plugins = [
]
```

## Mapping Model

The mapping model deals with geospatial mappings from the road network graph. This may be represented using the graph vertices and drawing lines between coordinates, or, by loading LineString geometries from a file.

For example, if you specify your query origin and destination as lat/lon coordinates (i.e. `origin_x`, `origin_y`) we need a way to match this to the graph and then insert an `origin_vertex` or a `destination_vertex` into the query. Those two fields are what the application expects when conducting a search.

For vertex-oriented mapping, all fields are optional.

```toml
[mapping]
type = "vertex"

# # when type = "vertex", this can be omitted, and the system will
# # instead use the graph vertex coordinates to build map geometries
# # which produces far simpler route sequences as a result.
# geometry_input_file = "edges-geometries-enumerated.txt.gz"

# # optional query distance tolerance for map matching.
# tolerance.distance = 15.0
# tolerance.unit = "meters"

# # allow user to submit queries without destinations, such as when
# # shortest path trees are the desired result, not routes. true by default.
# queries_without_destinations = true

# # the default map input type is a combined strategy that attempts to
# # match by Point, otherwise expects the user to pass either a vertex ({origin|destination}_vertex)
# # or an edge ({origin|destination}_edge). a more restrictive strategy can be
# # specified here with a subset of these values or a single value such as "point".
# matching_type = ["point", "edge_id", "vertex_id"]
```

Edge-oriented mapping uses some additional (non-optional) line geometry input and builds a spatial lookup over those lines.

This model will map coordinates to `origin_edge` or a `destination_edge` into the query.

As opposed to vertex-oriented mapping, the edge-oriented will additionally apply any frontier model rules to any mapped edges, preventing mapping assignments that are invalid frontiers.

```toml
[mapping]
type = "edge"
geometry_input_file = "edges-geometries-enumerated.txt.gz"

# # optional query distance tolerance for map matching.
# tolerance.distance = 15.0
# tolerance.unit = "meters"

# # allow user to submit queries without destinations, such as when
# # shortest path trees are the desired result, not routes. true by default.
# queries_without_destinations = true

# # the default map input type is a combined strategy that attempts to
# # match by Point, otherwise expects the user to pass either a vertex ({origin|destination}_vertex)
# # or an edge ({origin|destination}_edge). a more restrictive strategy can be
# # specified here with a subset of these values or a single value such as "point".
# matching_type = ["point", "edge_id", "vertex_id"]
```

## Traversal Models

Traversal models are what the application uses when computing a path through the graph.
Expand Down Expand Up @@ -337,44 +403,6 @@ The grid search plugin would take this single query and generate two queries tha
type = "grid_search"
```

### Vertex RTree

The vertex RTree plugin uses an RTree to match coordiantes to graph verticies.

For example, if you specify your query origin and destination as lat/lon coordinates (i.e. `origin_x`, `origin_y`) we need a way to match this to the graph and then insert an `origin_vertex` or a `destination_vertex` into the query. Those two fields are what the application expects when conducting a search.

```toml
[[plugin.input_plugins]]
type = "vertex_rtree"
# the vertices of the graph; enumerated to match the index of the graph vertex file
vertices_input_file = "vertices-compass.csv.gz"
```

### Edge RTree

The edge RTree plugin uses an RTree to match coordiantes to graph edges.

For example, if you specify your query origin and destination as lat/lon coordinates (i.e. `origin_x`, `origin_y`) we need a way to match this to the graph and then insert an `origin_edge` or a `destination_edge` into the query.

The Edge RTree has some additional paramters as comparted to the Vertex RTree.
Specifically, the Edge RTree takes in geomteries for each edge as well as road classes for each edge.
It uses the geometries for computing the distance between the incoming points and the edge.

In addition, it uses the road classes to optionally filter out road classes that need to be excluded at query time by supplying a "road_classes" argument to the query with a list of strings to match against.

```toml
[[plugin.input_plugins]]
type = "edge_rtree"
# geometries for each edge; enumerated to match the index of the graph edge file
geometry_input_file = "edge-geometries.csv.gz"
# road classes for each edge; enumerated to match the index of the graph edge file
road_class_input_file = "road-classes.csv.gz"
# how far around the point to search (smaller could improve performance but too small might result in no matches)
distance_tolerance = 100
# unit of the distance tolerance
distance_unit = "meters"
```

### Load Balancer

The load balancer plugin estimates the runtime for each query. That information is used by `CompassApp` in order to best leverage parallelism.
Expand Down Expand Up @@ -430,14 +458,13 @@ Here are the default output plugins that are provided:

### Traversal

A plugin that appends various items to the result.
A plugin that appends various items to the result. It leverages the mapping model for route and tree geometry generation.

```toml
[[plugin.output_plugins]]
type = "traversal"
route = "geo_json"
tree = "geo_json"
geometry_input_file = "edges-geometries-enumerated.txt.gz"
```

The `route` key will add route information to the result depending on the type.
Expand Down
Loading
Loading