glenpierce/UBHub

UBIF-0015 Can polygons share markers?

Closed this issue · 2 comments

Describe the bug
When I create a chart of two overlapping habitats, the first habitat populates all of its observations, but then prevents the second habitat from also populating observations. Question: How should we handle overlapping polygons?

To Reproduce
Steps to reproduce the behavior:

  1. Go to UBIF 2.0
  2. Create two separate habitats with two polygons, the second completely enclosing the first.
  3. Create a Chart
  4. See error

Expected behavior
Unknown. We need clarity here.

Screenshots
In the example below, the larger external polygon was drawn second and only contains one observation, the smaller polygon that was drawn first is trying to prevent duplicate counting, but this may be in error.
polygon exclusion question

We know where this is happening in the code:

for (i = 0; i < markers.length; i++) {
                    for (k = 0; k < sites.length; k++) {
                        if (sites[k].Polygon.Contains(markers[i].getPosition())) {
                            sites[k].markers.push(markers[i]);
                            break; <--- Here is our problem
                        }
                    }
                }

This is resolved at Step 3: Verify Data. We will be importing all and allowing the user to then run it by the verification process.