hackforla / 311-data

Empowering Neighborhood Associations to improve the analysis of their initiatives using 311 data
https://hackforla.github.io/311-data/
GNU General Public License v3.0
62 stars 64 forks source link

1540 Handle zooming in on MultiPolygon NCs #1858

Closed kdow closed 5 days ago

kdow commented 1 week ago

Fixes #1540

Info

ECHO PARK NC and NC VALLEY VILLAGE are classified as MultiPolygons and won't zoom in when searched for in the Address Search. I found this section of geoUtils.js that filters out the two MultiPolygon NCs since they weren't working with booleanPointInPolygon.

Changes Made

booleanPointInPolygon can take a polygon or multipolygon, but the feature type needs to be specified. We can use a for loop with a conditional so we can use either polygon(feature.geometry.coordinates)  or multiPolygon(feature.geometry.coordinates) with booleanPointInPolygon.

With the change I checked an address in Echo Park (1226 N Alvarado, Los Angeles, CA 90026), one in Valley Village (5000 Colfax Avenue, Valley Village, CA 91607), and one outside of either of those NCs, and they all zoomed in properly. (The addresses in Echo Park and Valley Village do not zoom in with the current codebase without this fix).

Pre-merge Checklist

Any questions? See the getting started guide