fix zoom on single station
The GBFS validator visualizer kept zooming on a station when the passed GBFS feed only contained 1 station.
closes: #133
Reason:
This was caused by the fact that the mapInstance.fitBounds(bboxPolygon(geojson)) didn't behave as expected when called with just one data point, as the function will fit the view to the given area. If the passed parameter has an area of 0 (it's a single point) it'll continue to zoom indefinitely.
I created an utility function fitBoundsForGeojson to address this issue and fly to the specific station in case it's one. It will also be used for the vehicles and geofencing layer as well, as they'd also be subject to the same issue.
Feed used for testing: https://data.lime.bike/api/partners/v2/gbfs/opfikon/gbfs.json
Before:
https://github.com/user-attachments/assets/f329b431-0a36-46b3-b8f5-c500c594c0be
After:
https://github.com/user-attachments/assets/21e8f140-ff4f-4ff3-ba55-109a3a09557a
Deploy request for gbfs-validator pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | 3fbb60447e6b2c596a69315b6e33bde49c967d2b |
@davidgamez @Alessandro100 created this PR to solve #133, please have a look when you get the chance. Thank you!