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

Add oe_get_network #218

Merged
merged 11 commits into from
Jul 13, 2021
Merged

Add oe_get_network #218

merged 11 commits into from
Jul 13, 2021

Conversation

agila5
Copy link
Contributor

@agila5 agila5 commented Jul 6, 2021

Just the first ideas. Will need to fix the filters + several intermediate checks.

@Robinlovelace what do you think about the name of the function?

@Robinlovelace
Copy link
Member

It sounds good. An alternative would be oe_get_network() - have a very mild preference for that but would be interested to see what others think. Great to see use of the querying to get that data quickly!

@agila5 agila5 changed the title Add oe_get_transport Add oe_get_network Jul 9, 2021
@agila5
Copy link
Contributor Author

agila5 commented Jul 12, 2021

@Robinlovelace can you check the options set for the three modes of transport? If those are ok, I just need to document the function.

Copy link
Member

@Robinlovelace Robinlovelace left a comment

Choose a reason for hiding this comment

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

This is a great start.

Minor comments:

  • In terms of documentation it's worth mentioning and adding a link to the source for the filters
  • One for later: document how to create a custom network creation function, e.g. net_wheelchair()
  • Mixed styles, the package has = and <- assignment on this branch

These are minor points. Overall big 👍

'planned', 'platform', 'proposed', 'raceway'
))
AND
(foot IS NULL OR foot != 'no')
Copy link
Member

Choose a reason for hiding this comment

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

I was going to sat that motorways cannot be cycled on with reference to https://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway

But then I read there that highway=motorway implies that bicycle=no.

Do we no if that tag gets auto tagged?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at a motorway in Leeds that you definitely cannot cycle on I don't think it does get auto added: https://www.openstreetmap.org/way/400349319

'fixme', 'escalator', 'gallop', 'historic', 'no', 'planned', 'platform',
'proposed', 'raceway', 'steps'
)) OR (
highway IN ('motorway', 'motorway_link', 'footway',
Copy link
Member

Choose a reason for hiding this comment

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

OK I see motorway is excluded, great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Motorways and motorway_links are always excluded unless the same OSM way has "bicycle = yes" (as documented here)

@agila5
Copy link
Contributor Author

agila5 commented Jul 12, 2021

Thanks for the comments! Tomorrow I will fix the docs.

@agila5 agila5 marked this pull request as ready for review July 13, 2021 08:54
@agila5 agila5 requested a review from Robinlovelace July 13, 2021 08:54
Copy link
Member

@Robinlovelace Robinlovelace left a comment

Choose a reason for hiding this comment

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

Overall great PR, very useful new functionality and ready to ship now 🚢

My comments are minor and can be tidied up post merge - feel free to change any of my commits to this branch also @agila5. Thanks for great work on this 🎉

@@ -25,7 +25,7 @@ jobs:
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
# - {os: macOS-latest, r: 'release'}
Copy link
Member

Choose a reason for hiding this comment

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

FYI this can be re-added if you add the lines shown here to the .yaml file:

a-b-street/abstr@a374477

I suggest this is a separate issue, just mentioning here as an FYI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

#' @export
#'
#' @details The `cycling` mode of transport (i.e. the default value for `mode`
#' parameter) selects the OSM ways that meet the following conditions:
Copy link
Member

Choose a reason for hiding this comment

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

Great to have these details.

#' @return An `sf` object.
#' @export
#'
#' @details The definition of usable transport network was taken from
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct @agila5 ? If we modify the rules we could say 'was inspired by' but as far as I'm aware this is currently like-for-like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not exactly "taken" from osmnx but I will slightly change that in master branch, 👍

#'
#' @seealso [`oe_get()`]
#'
#' @examples
Copy link
Member

Choose a reason for hiding this comment

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

Great examples.

oe_get_options = check_args_network(dots_args, oe_get_options)

# Run oe_get
do.call(oe_get, oe_get_options)
Copy link
Member

Choose a reason for hiding this comment

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

Clever! I learned something from this, I think, all the named args are passed here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup! Thanks also to @luukvdmeer and @loreabad6, I learned that when reading the code behind plot.sfnetwork 😅


# The following functions are used to load several ad-hoc vectortranslate
# options according to a specific mode of transport. The choices are documented
# in oe_get_network() and are based on the following documents:
Copy link
Member

Choose a reason for hiding this comment

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

Big 👍 for including these links, may make my previous comment about osmnx redundant.

@agila5 agila5 merged commit a42a32d into master Jul 13, 2021
@Robinlovelace Robinlovelace deleted the get-mode branch July 13, 2021 13:39
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.

2 participants