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

deprecate buffer_dist and clean_periphery arguments #1044

Merged
merged 6 commits into from
Jul 25, 2023
Merged

deprecate buffer_dist and clean_periphery arguments #1044

merged 6 commits into from
Jul 25, 2023

Conversation

gboeing
Copy link
Owner

@gboeing gboeing commented Jul 25, 2023

This PR:

  • deprecates the buffer_dist function parameter in the graph, features, and geocoder modules. It is seldom used, it clutters the codebase, and its functionality is easily reproduced by the user with ~1 line of code.
  • deprecates the clean_periphery function parameter in the graph module: the equivalent of clean_periphery=True will the the uniform behavior going forward. This is the only way to generate an accurate graph on the perimeter, and the only way to get accurate stats, so it really makes no sense to have a False option here. See also (fix bug: streets per node is not calculated when clean_periphery=False #775).
  • updates the docs with some explanatory details regarding (now-standard) periphery cleaning

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #1044 (0a4d1ab) into main (a3aefcc) will decrease coverage by 0.08%.
The diff coverage is 81.81%.

❗ Current head 0a4d1ab differs from pull request most recent head b8407ca. Consider uploading reports for the commit b8407ca to get more accurate results

@@            Coverage Diff             @@
##             main    #1044      +/-   ##
==========================================
- Coverage   97.71%   97.64%   -0.08%     
==========================================
  Files          26       26              
  Lines        2456     2467      +11     
==========================================
+ Hits         2400     2409       +9     
- Misses         56       58       +2     
Files Changed Coverage Δ
osmnx/features.py 94.14% <66.66%> (-0.33%) ⬇️
osmnx/graph.py 98.75% <80.00%> (-0.61%) ⬇️
osmnx/geocoder.py 90.12% <100.00%> (+0.37%) ⬆️

@gboeing gboeing merged commit ef6423b into main Jul 25, 2023
5 checks passed
@gboeing gboeing deleted the dep branch July 25, 2023 19:45
@EwoutH
Copy link
Contributor

EwoutH commented Mar 26, 2024

  • its functionality is easily reproduced by the user with ~1 line of code.

What would be the proper way to replace buffer_dist? (in this case with graph_from_place)

Edit: Would that be this example? Or can it be done more elegantly?

# or get the walking network within a 500 meter buffer of piedmont
polygon = ox.geocode_to_gdf("Piedmont, California, USA").loc[0, "geometry"]
poly_proj, crs_proj = ox.projection.project_geometry(polygon)
polygon, _ = ox.projection.project_geometry(poly_proj.buffer(500), crs=crs_proj, to_latlong=True)
G = ox.graph_from_polygon(polygon, network_type="walk")

@gboeing
Copy link
Owner Author

gboeing commented Mar 27, 2024

Yes that example does the job. My initial comment was overly conservative... it takes ~3 lines of code. Though it could be a single line of code for simpler use cases.

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.

None yet

2 participants