Skip to content

Conversation

@SinthTeck
Copy link
Contributor

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:

Screen.Recording.2025-11-20.at.7.25.28.PM.mov

After:

Screen.Recording.2025-11-20.at.7.24.50.PM.mov

@netlify
Copy link

netlify bot commented Nov 21, 2025

👷 Deploy request for gbfs-validator pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3fbb604

@SinthTeck
Copy link
Contributor Author

SinthTeck commented Nov 28, 2025

@davidgamez @Alessandro100 created this PR to solve #133, please have a look when you get the chance. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoom on visualization only focuses on stations

1 participant