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

Optimize _remove_polygon_holes and _create_gdf for performance #1205

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

wrignj08
Copy link
Contributor

This pull request addresses issue #1200 by optimizing the _remove_polygon_holes function to improve performance when dealing with complex geometries. Additionally, it enhances the efficiency of the _create_gdf function.

Changes proposed in this pull request:

  1. Optimized _remove_polygon_holes function to use shapely.prepared geometries and perform a single difference operation per outer polygon.
  2. Updated _create_gdf function to improve performance and avoid PerformanceWarnings.
  3. Added prepare import from shapely.

The functionality remains the same, just faster on complex polygons.
ox.features.features_from_point((46.18, 74.42), tags={"natural": "water"}, dist=50000)

The CHANGELOG.md has been updated to reflect these changes.

The changes have been tested and all tests pass with the exception of mypy failed on osmnx/plot.py:856, but this was an existing issue and not related to the changes in this PR. As such, --no-verify was used to bypass the GitHub precommit hooks.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.30%. Comparing base (29addce) to head (2b10aac).

Additional details and impacted files
@@            Coverage Diff             @@
##            tests    #1205      +/-   ##
==========================================
- Coverage   98.31%   98.30%   -0.01%     
==========================================
  Files          24       24              
  Lines        2367     2366       -1     
==========================================
- Hits         2327     2326       -1     
  Misses         40       40              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gboeing gboeing changed the base branch from main to tests August 14, 2024 20:40
@gboeing gboeing merged commit f336e18 into gboeing:tests Aug 14, 2024
7 checks passed
@gboeing gboeing mentioned this pull request Aug 14, 2024
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