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

Return LineString geometries on expansion #4275

Merged
merged 21 commits into from
Dec 11, 2023
Merged

Conversation

nilsnolde
Copy link
Member

@nilsnolde nilsnolde commented Aug 27, 2023

fixes #4266

  • makes /expansion return LineStrings
  • adds the field pred_edge_id to the response to figure expansion

The config limit is the same as before: it's derived from the expansion action. We could adapt that logic, but I'd do that in a follow-up PR if it's wanted.

Is based on #4263 , so let's merge that first.

@@ -373,7 +373,9 @@ bool Options_ExpansionProperties_Enum_Parse(const std::string& prop,
{"durations", Options_ExpansionProperties_durations},
{"distances", Options_ExpansionProperties_distances},
{"statuses", Options_ExpansionProperties_statuses},
{"edge_ids", Options::ExpansionProperties::Options_ExpansionProperties_edge_ids}};
{"edge_ids", Options::ExpansionProperties::Options_ExpansionProperties_edge_ids},
Copy link
Member Author

@nilsnolde nilsnolde Aug 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to rename that? previously it was the same field name in the response, but it's the singular version i.e. edge_id instead of edge_ids. would be nicer to have them consistent IMO. now that we're breaking compatibility

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree that we can break this, its still beta

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also why n ot use the shorter alias of this property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let me get that in real quick. also the shorter version.

Comment on lines +364 to +366
expansion_callback_(graphreader, FORWARD ? meta.edge_id : opp_edge_id, prev_pred,
"bidirectional_astar", "r", newcost.secs,
pred.path_distance() + meta.edge->length(), newcost.cost);
Copy link
Member Author

@nilsnolde nilsnolde Aug 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed all callbacks to use the end of the current edge for cost & distance. Most were doing that already, but not the "reached" ones. That's really confusing when looking at the results.

@nilsnolde
Copy link
Member Author

done @kevinkreiser , also renamed status to edge_status due to a proto enum clash with actions::status.

@nilsnolde nilsnolde mentioned this pull request Oct 21, 2023
9 tasks
@nilsnolde
Copy link
Member Author

Can we merge here? I need to use matrix expansion on many PRs right now and it's painful to merge this branch around.

Comment on lines +25 to +30
| `distance` | Returns the accumulated distance in meters for each edge in order of graph traversal. |
| `duration` | Returns the accumulated duration in seconds for each edge in order of graph traversal. |
| `cost` | Returns the accumulated cost for each edge in order of graph traversal. |
| `edge_id` | Returns the internal edge IDs for each edge in order of graph traversal. Mostly interesting for debugging. |
| `pred_edge_id` | Returns the internal edge IDs of the predecessor for each edge in order of graph traversal. Mostly interesting for debugging. |
| `edge_status` | Returns the edge states for each edge in order of graph traversal. Mostly interesting for debugging. Can be one of "r" (reached), "s" (settled), "c" (connected). |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one day we'll have to make this no longer beta and lock down the api 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d be fine with lifting the BETA status actually. I’ve used it now quite a bit. Apart from that one bug where random edges are included for isochrones, which I’d really like to fix first.

@kevinkreiser
Copy link
Member

this looks fine to me!

@nilsnolde nilsnolde merged commit 0374819 into master Dec 11, 2023
9 checks passed
@nilsnolde nilsnolde deleted the nn-expansion-linestring branch December 11, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expansion output to LineStrings
2 participants