Skip to content

fix: reject degenerate polygons in AOI area validation - #465

Closed
heathdutton wants to merge 1 commit into
hotosm:developfrom
heathdutton:fix/228-small-aoi-validation
Closed

heathdutton wants to merge 1 commit into
hotosm:developfrom
heathdutton:fix/228-small-aoi-validation

Conversation

@heathdutton

@heathdutton heathdutton commented Jan 2, 2026 •

Copy link
Copy Markdown

Fixes #228

When drawing an AOI at low zoom levels, the polygon coordinates can collapse to nearly identical points, resulting in a degenerate polygon with zero area. The validateGeoJSONArea function was incorrectly returning false (valid) for these cases instead of true (invalid). Confused? So was I.

This one-line fix correctly rejects polygons with zero, NaN, or invalid area values.

@kshitijrajsharma

Copy link
Copy Markdown
Member

Thanks @heathdutton for the PR , we will be reviewing this soon !

@jeafreezy

Copy link
Copy Markdown
Collaborator

Thank you for your contribution @heathdutton .

The issue this PR intends to fix was happening before the latest development on fAIr. As of now, you can't experience the bug again because we now have a minimum size for drawing a polygon. See attached video for context.

Screen.Recording.2026-01-18.at.17.22.34.mov

Nevertheless, we'll have this PR opened for merging should such issue come up again in the future.

Thank you!

@jeafreezy jeafreezy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@heathdutton
heathdutton force-pushed the fix/228-small-aoi-validation branch from fe1753c to 435f1c2 Compare October 5, 2026 16:14
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Contributor Signature Required

Thank you for your contribution!

Before we can accept your pull request, you need to sign our Contribution Policy.

Why do I need to do this?

  • Ensures you have read and will abide by our contribution guidelines.
  • Adds a small barrier for bot / AI account contribution, which we do not allow.
  • We care deeply about our community at HOT, and want everyone to be on the same page.

How to sign

To sign the agreement, please comment on this PR with:

I have read the CONTRIBUTING.md document and I hereby sign and agree with the guidelines

⚠️ Note: You only need to sign once. Future contributions to this repository will not require re-signing.


I have read the CONTRIBUTING.md document and I hereby sign and agree with the guidelines


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@heathdutton heathdutton closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation for small AOI

3 participants