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

Fix densification functions #412

Merged
merged 6 commits into from
Mar 31, 2023
Merged

Conversation

pjhartzell
Copy link
Collaborator

@pjhartzell pjhartzell commented Mar 27, 2023

Related Issue(s):

Description:

  • Replaces the densify_by_distance algorithm to retain the original polygon vertices (which fixes densify_by_distance not retaining original polygon vertices #411 ) and to only add new points on polygon segments longer than the distance argument. Example image (same as shown in the issue) showing the now correctly densified polygon:

image

  • Fixes a problem with densify_by_factor where the last/closing vertex was not included in the returned densified point list.
  • Makes the footprint method return counter-clockwise polygons to align with the GeoJSON specification. Updates tests to use counter-clockwise polygons. I found that Shapely's convex_hull and simplify methods return clockwise polygons, so these methods are now wrapped in an Shapely's orient function to enforce counter-clockwise polygons.

PR checklist:

  • Code is formatted (run scripts/format).
  • Code lints properly (run scripts/lint).
  • Tests pass (run scripts/test).
  • Documentation has been updated to reflect changes, if applicable.
  • Changes are added to the CHANGELOG.

densify_by_distance now retains the original polygon vertex coordinates
densify_by_factor now retains the last vertex in the original polygon
The new algorithm only inserts new points on polygon segments longer
than the `distance` argument.
@pjhartzell pjhartzell requested a review from gadomski as a code owner March 27, 2023 19:11
@pjhartzell pjhartzell merged commit c2bdf32 into main Mar 31, 2023
@pjhartzell pjhartzell deleted the issues/411-densify-by-distance branch March 31, 2023 12:21
@gadomski gadomski modified the milestones: 0.5.0, 0.4.6 Apr 10, 2023
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.

densify_by_distance not retaining original polygon vertices
2 participants