mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(bikeshare): drop stations outside a city's load radius
Bogotá's and Santiago's PBSC feeds list depot stations in São Paulo and Madrid as installed and renting, so activating either city drew live docks thousands of kilometres away and counted them in the layer total. Station information is now limited to the city's registered load radius; every other registered feed already sits inside its radius (checked live 2026-10-16), so nothing else changes. Adds a Bogotá/Santiago registry test matching the Brazilian and Barcelona ones: proxy allowlist, outermost-station activation and radius reach, and the depot filter through the real ingestion path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c5feec26dc
commit
7a38727b85
3 files changed
+203
-1
No files matched your search
@@ -39,11 +39,36 @@ export function createModel({ state: layerState, services, parts, source }) {
|
||||
return 6371 * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop stations outside a city's load radius. Some operators list depots on
|
||||
* other continents as in-service stations in a city's feed (Bogotá's and
|
||||
* Santiago's PBSC feeds carry warehouses in São Paulo and Madrid), which
|
||||
* would otherwise draw as live docks thousands of kilometres away.
|
||||
* @param {{ centerLat: number, centerLon: number, loadRadiusKm: number }} city
|
||||
* @param {Map<string, Object>} stationMap - Parsed station info map.
|
||||
* @returns {Map<string, Object>} Stations within the city's load radius.
|
||||
*/
|
||||
|
||||
function stationsWithinCity(city, stationMap) {
|
||||
const kept = new Map();
|
||||
for (const [stationId, station] of stationMap) {
|
||||
const distance = haversineKm(
|
||||
city.centerLat,
|
||||
city.centerLon,
|
||||
station.lat,
|
||||
station.lon,
|
||||
);
|
||||
if (distance <= city.loadRadiusKm) kept.set(stationId, station);
|
||||
}
|
||||
return kept;
|
||||
}
|
||||
|
||||
return {
|
||||
normalizeGbfsBool,
|
||||
toNonNegativeInteger,
|
||||
stationKey,
|
||||
haversineKm,
|
||||
stationsWithinCity,
|
||||
extractStationsArray,
|
||||
parseStationInformation,
|
||||
parseStationStatus,
|
||||
|
||||
Reference in new issue
Block a user