-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add departure headings calculation #247
Conversation
Add departure headings calculation and output departure headings as a separate column in edges-headings-enumerated.csv.
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.
This is looking great! I left a couple of small comments but I like how simple you've kept this
@@ -209,3 +206,38 @@ def replace_id(vertex_uuid): | |||
with importlib.resources.as_file(model_file) as model_path: | |||
model_dst = model_output_directory / model_path.name | |||
shutil.copy(model_path, model_dst) | |||
|
|||
#Function written by Nick Reinicke | |||
def compass_heading(point1, point2): |
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.
Could we move these functions into the utils module?
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.
|
||
return compass_bearing | ||
|
||
#Function written by Nick Reinicke |
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 appreciate the attribution but I'm okay if we omit them 🙂
Removed the two functions for calculating bearings and put them into utils.py. Changed the calculate_bearings call accordingly.
Moving compass_heading and calculate_bearings functions over from generate_dataset.py
I added the two functions to
For testing these changes locally, I added a name == main if statement to the bottom of the file with parameters to run:
Ran with
All is well! |
Fixing utils import
@nreinicke tests failed because the runner couldn't find utils, so I changed the
in commit b6cbd62. Hopefully this solves it! |
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.
Excellent, looks good!
In reference to #202:
Previously, generate_dataset would calculate the arrival heading using the preset osmnx
.bearing
method, while departure headings were set toNone
.This PR adds two functions written by @nreinicke:
calculate_bearings
, which passes in linestrings and determines what to do with the coordinates based on the number of lat lon pairscompass_heading
, which calculates a compass bearing based on two lat lon pairsThese functions replace the osmnx method used previously, rather than using osmnx for arrival and the functions for departure. Both headings are added to the same data frame and output to edges-headings-enumerated.csv