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

PIMS-305 Spatial Analysis #2716

Merged
merged 22 commits into from
Oct 8, 2024
Merged

PIMS-305 Spatial Analysis #2716

merged 22 commits into from
Oct 8, 2024

Conversation

dbarkowsky
Copy link
Collaborator

@dbarkowsky dbarkowsky commented Oct 3, 2024

🎯 Summary

PIMS-305

Changes

  • Added Polygon as part of the map properties search schema
  • Added cases in the properties service for map properties to filter by the location
  • Created functions to assist with filtering by detecting if a point is contained within a polygon or series of polygons. The alternative was to try and set up PostGIS both locally and in OpenShift. I was worried that this filtering version might be slower than PostGIS (probably is), but it's actually very fast so far, so I don't think PostGIS is necessary.
  • Fixed hideControls prop on the ParcelMap. It was only hiding an old version of the filter we never removed. It should now hide the map layer controls and the polygon drawing controls as expected.
  • Adjusted how the map zooms after property filter changes. It will now prioritize the polygons, then the properties. There is also a buffer to the right side to account for the filter and sidebar, so hopefully filtered properties won't be hidden by that anymore.
  • Added prop that tracks when map events should be disabled. In this case, it was because I didn't want the popup to appear or the map to scroll when drawing polygons.

Testing

  • On the map page, use the controls in the bottom left to draw polygons. Apart from some edge cases, it should filter properties based on which ones are in that polygon. Can draw multiple polygons too.
  • Combine this with the map filter.
  • See that controls are hidden on other map uses where properties are not loaded.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link

github-actions bot commented Oct 3, 2024

🚀 Deployment Information

The React APP Image has been built with the tag: 2716. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the APP deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link

codeclimate bot commented Oct 4, 2024

Code Climate has analyzed commit c3b8ba6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 93.4%.

View more on Code Climate.

@dbarkowsky
Copy link
Collaborator Author

Noting an issue with the ray-casting algorithm used to determine if points are inside polygons. It sometimes returns points to the left of polygons as well, and I think it's an issue with floating point math and lost precision.

Copy link
Collaborator

@LawrenceLau2020 LawrenceLau2020 left a comment

Choose a reason for hiding this comment

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

Works great! I can draw multiple shapes to filter properties as well as combining the map filter to further filter the properties. Deleting shapes to remove the properties that were selected also works.

@dbarkowsky dbarkowsky merged commit a64fa24 into main Oct 8, 2024
12 checks passed
@dbarkowsky dbarkowsky deleted the PIMS-305-Spatial-Analysis branch October 8, 2024 18:10
dbarkowsky added a commit that referenced this pull request Oct 8, 2024
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.

2 participants