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

Documentation on extending the package #153

Open
Robinlovelace opened this issue Dec 8, 2020 · 7 comments
Open

Documentation on extending the package #153

Robinlovelace opened this issue Dec 8, 2020 · 7 comments

Comments

@Robinlovelace
Copy link
Member

The package is very useful in some areas so I think we should encourage domain-specific functions to be written, e.g. oe_get_cycleways() to get cycleways with the appropriate query. However, such functions are best suited to packages that build on osmextract which I think should be kept to generic functionality to avoid mission creep.

Proposed solution: vignette (or content in a paper/article/blog) documenting how to write functions that extend osmextract, e.g. based on a hypothetical package called osmcycleinfra.

@Robinlovelace
Copy link
Member Author

Ping @mvl22 any ideas on this welcome after conversation today.

@mvl22
Copy link

mvl22 commented Dec 8, 2020

Yes, I agree that a general-purpose 'mechanics' package like osmextract is probably best not concerned with domain-specific functionality, which is best in a separate package, since that is a higher-level concern.

PS I would flag my usual caution that a function like oe_get_cycleways should be extremely clear as to what it does or doesn't cover. People constantly ask us "how do we get the cycle network from OSM", to which the answer is "please define cycle network". Just getting highway=cycleway is inadequate.

@Robinlovelace
Copy link
Member Author

PS I would flag my usual caution that a function like oe_get_cycleways should be extremely clear as to what it does or doesn't cover. People constantly ask us "how do we get the cycle network from OSM", to which the answer is "please define cycle network".

Agreed.

The documentation of extending this package, and possibly an osmcycleinfra package could help people answer that question : )

@Robinlovelace
Copy link
Member Author

@mvl22
Copy link

mvl22 commented Dec 9, 2020

Well, that is one view, yes.

@agila5
Copy link
Collaborator

agila5 commented Jul 2, 2021

Hi @Robinlovelace and @mvl22 and thank you for starting this discussion. I'd like to work on this problem in the next days and I was wondering if there are official guidelines on how to subset OSM data for walking/cycling/driving mode of transport. Suggestions are welcome!

@Robinlovelace
Copy link
Member Author

Hi @agila5 see below for a good 'starter for 10' on tags for different modes (walk/bike/drive). Source: https://github.com/gboeing/osmnx/blob/c17ad723223fead5b1cd6d15e60ba91ba5a19154/osmnx/downloader.py

As far as I can tell this is hardcoded specifically for the OSMnx project and it may be good to be more flexible.

I know @mpadge has implemented this functionality for osmdata. Any tips/tricks/ideas Mark?

Cheers!

filters["drive"] = (
    f'["highway"]["area"!~"yes"]{settings.default_access}'
    f'["highway"!~"abandoned|bridleway|bus_guideway|construction|corridor|cycleway|elevator|'
    f"escalator|footway|path|pedestrian|planned|platform|proposed|raceway|service|"
    f'steps|track"]'
    f'["motor_vehicle"!~"no"]["motorcar"!~"no"]'
    f'["service"!~"alley|driveway|emergency_access|parking|parking_aisle|private"]'
)

# drive+service: allow ways tagged 'service' but filter out certain types
filters["drive_service"] = (
    f'["highway"]["area"!~"yes"]{settings.default_access}'
    f'["highway"!~"abandoned|bridleway|bus_guideway|construction|corridor|cycleway|elevator|'
    f'escalator|footway|path|pedestrian|planned|platform|proposed|raceway|steps|track"]'
    f'["motor_vehicle"!~"no"]["motorcar"!~"no"]'
    f'["service"!~"emergency_access|parking|parking_aisle|private"]'
)

# walking: filter out cycle ways, motor ways, private ways, and anything
# specifying foot=no. allow service roads, permitting things like parking
# lot lanes, alleys, etc that you *can* walk on even if they're not
# exactly pleasant walks. some cycleways may allow pedestrians, but this
# filter ignores such cycleways.
filters["walk"] = (
    f'["highway"]["area"!~"yes"]{settings.default_access}'
    f'["highway"!~"abandoned|bus_guideway|construction|cycleway|motor|planned|platform|'
    f'proposed|raceway"]'
    f'["foot"!~"no"]["service"!~"private"]'
)

# biking: filter out foot ways, motor ways, private ways, and anything
# specifying biking=no
filters["bike"] = (
    f'["highway"]["area"!~"yes"]{settings.default_access}'
    f'["highway"!~"abandoned|bus_guideway|construction|corridor|elevator|escalator|footway|'
    f'motor|planned|platform|proposed|raceway|steps"]'
    f'["bicycle"!~"no"]["service"!~"private"]'
)

# to download all ways, just filter out everything not currently in use or
# that is private-access only
filters["all"] = (
    f'["highway"]["area"!~"yes"]{settings.default_access}'
    f'["highway"!~"abandoned|construction|planned|platform|proposed|raceway"]'
    f'["service"!~"private"]'
)

# to download all ways, including private-access ones, just filter out
# everything not currently in use
filters[
    "all_private"
] = '["highway"]["area"!~"yes"]["highway"!~"abandoned|construction|planned|platform|proposed|raceway"]'

agila5 added a commit that referenced this issue Jul 6, 2021
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

No branches or pull requests

3 participants